[Scilab-users] Get random number from a matrix

A Khorshidi akhorshidi at live.com
Sun Jun 8 13:20:17 CEST 2014


Samuel GOUGEON wrote
> 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

Hi all; 

Samuel, I think it will be handy if we have a function which can extract
randomly one, two or more entities of a matrix as well as can also be used
to return a random row/column of a matrix. 
Attached you can see a preliminary version of that function. 

Regards, 
Mehran

random_extraction.sce
<http://mailinglists.scilab.org/file/n4030697/random_extraction.sce>  

_




--
View this message in context: http://mailinglists.scilab.org/Get-random-number-from-a-matrix-tp4030691p4030697.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list