4.72 nrand - Random Numbers in Normal Distribution

Generate random numbers with specified mean and standard deviation.

The same random seed will generate the same sequence of random numbers. The random seed can be specified from -2147483648 to 2147483647. If the random seed is not defined, the random numbers will be seeded according to current time (1/1000 second).

This function uses Mersenne Twister as random number generator (Author’s original website , boost library)

Example

Example 1: Basic Example

Create a set of random numbers with a standard deviation between 0 to 1 (standard normal distribution). Set the random seed as 10.

$ more dat1.csv
id
1
2
3
4
$ mcal c='nrand(0,1,10)' a=rsl i=dat1.csv o=rsl1.csv
#END# kgcal a=rsl c=nrand(0,1,10) i=dat1.csv o=rsl1.csv
$ more rsl1.csv
id,rsl
1,0.1125259159
2,-0.8349559194
3,1.158317265
4,0.1518928088