[Scilab-users] Get random number from a matrix

Samuel Gougeon sgougeon at free.fr
Sat Jun 7 13:31:31 CEST 2014


Le 07/06/2014 02:30, Chuox a écrit :
> i found this solution, but i'm guessing there must be a more easy and
> efficient solution.
not really, may be just a little shorter:

Matrix = [25 ,32 ,40, 50] ;
random = Matrix(grand(1,1,"uin",1,length(Matrix)))

If Matrix is rather of text, length(Matrix) must be replaced with size(Matrix,"*")

Regards




More information about the users mailing list