Format: (minimum, maximum[, random seed])
Generate random integers between the specified minimum value to maximum value. The mrand command using -int option returns the same results. 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).
Generate random integers from 100 to 999 (3 digit integers 900 types). Since a random seed is specified, the random number sequence generated is always the same.
$ more dat1.csv id 1 2 3 4 $ mcal c='randi(100,999,1)' a=rsl i=dat1.csv o=rsl1.csv #END# kgcal a=rsl c=randi(100,999,1) i=dat1.csv o=rsl1.csv $ more rsl1.csv id,rsl 1,475 2,997 3,748 4,939
Generate two sets of random integers 0 and 1. The random sequence will be different upon each run since the random seed is not specified.
$ mcal c='randi(0,1)' a=rsl i=dat1.csv o=rsl2.csv #END# kgcal a=rsl c=randi(0,1) i=dat1.csv o=rsl2.csv $ more rsl2.csv id,rsl 1,1 2,0 3,0 4,1