Question: Generating random variables subject to conditions

M:=Array([[a+2*b,b],[x1+y1,z1+z2]]);
pars:=indets(M);
npars:=numelems(pars);

myRand:=RandomTools[Generate](float(range=-3..3),makeproc=true):

set1:={seq(pars[i]=myRand(),i=1..npars)};
numM:=subs(set1,M);
LinearAlgebra:-Rank(numM);

is there a way to make sure that the random values generated from myRand(), subs into M, to make sure that each cell of M is between 0 and 1?

Basically, what I need is being able to simulate some values, subject to each cell of M is between 0 and 1, and find the rank of M. I want to do that efficiently 20 times (or more possibly). Those values that make the cells out of 0 and 1 do not count as 1 of the 20 simulations.

 

Thanks,

 

casper

 

 

Please Wait...