Chapter Contents

Previous

Next
RANNOR

RANNOR



Returns a random variate from a normal distribution

Category: Random Number
Tip: If you want to change the seed value during execution, you must use the CALL RANNOR routine instead of the RANNOR function.


Syntax
Arguments
Details
Comparisons
See Also

Syntax

RANNOR(seed)

Arguments

seed
is an integer. For more information on seeds, see Seed Values.
Range: seed < 231-1
Note: If seed [le] 0, the time of day is used to initialize the seed stream.


Details

The RANNOR function returns a variate that is generated from a normal distribution with mean 0 and variance 1. The Box-Muller transformation of RANUNI uniform variates is used.

A normal variate X with mean MU and variance S2 can be generated with this code:

x=MU+sqrt(S2)*rannor(seed);

A lognormal variate X with mean exp(MU + S2/2) and variance exp(2*MU + 2*S2) -exp(2*MU + S2) can be generated with this code:

x=exp(MU+sqrt(S2)*rannor(seed));


Comparisons

The CALL RANNOR routine, an alternative to the RANNOR function, gives greater control of the seed and random number streams.

See Also

Call routine:

CALL RANNOR


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.