Previous Page | Next Page

Language Reference

UNIFORM Function

UNIFORM( seed ) ;

The UNIFORM function generates a pseudorandom numbers from the uniform distribution on . The seed argument is a numeric matrix or literal. The elements of the seed argument can be any integer value up to .

The UNIFORM function returns one or more pseudorandom numbers with a uniform distribution over the interval 0 to 1. The UNIFORM function returns a matrix with the same dimensions as the argument. The first argument on the first call is used for the seed, or if that argument is 0, the system clock is used for the seed. The function is equivalent to the DATA step function RANUNI.

The following statements produce the output shown in Figure 23.195:

seed = 123456;
c = j(10, 1, seed);        /* generate 10 number from the same seed */
b = uniform(c);
print b;

Figure 23.227 Random Values Generated from a Uniform Distribution
Test of NLPHQN subroutine: No Derivatives

b
0.73902
0.2724794
0.7095326
0.3191636
0.367853
0.104491
0.0368003
0.5333324
0.3712995
0.0401944

For generating millions of pseudorandom numbers, use the RANDGEN function.

Previous Page | Next Page | Top of Page