Previous Up Next

5.38.36  Make a random vector or list : randvector

randvector takes as argument an integer n and optionally a second argument, either an integer k or the quoted name of a random distribution law (see also 5.25.25).
randvector returns a vector of size n containing random integers uniformly 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 :

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