Previous Up Next

2.37.36  Make a random vector or list : randvector

randvector takes as argument an integer n and optionnally a second argument, either an integer k or the quoted name of a random distribution law (see also 2.24.25, 2.37.36 and ??).
randvector returns a vector of size n containing random integers uniformally distributed between -99 and +99 (default), or between 0 and k−1 or containing random integers according to the law put between quotes.
Input :

randvector(3)

Output :

[-54,78,-29]

Input :

randvector(3,5)

Or input :

randvector(3,’rand(5)’)

Output :

[1,2,4]

Input :

randvector(3,’randnorm(0,1)’)

Output :

[1.39091705476,-0.136794772167,0.187312440336]

Input :

randvector(3,2..4)

Output :

[3.92450003885,3.50059241243,2.7322040787]

Previous Up Next