Mercurial > hg > trimatlab
annotate private/randnat.m @ 15:a6d5597bd922
Trying alternative fixed point computation in mc_global_info1>mc_fixpt2;
Also factored out randnat from some other functions.
author | samer |
---|---|
date | Mon, 27 Feb 2012 14:41:24 +0000 |
parents | 0e0f2805ef9c |
children |
rev | line source |
---|---|
samer@15 | 1 function X=randnat(M) |
samer@15 | 2 % randnat - Draw random natural number from uniform distribution |
samer@11 | 3 % |
samer@11 | 4 % randnat :: |
samer@11 | 5 % M:natural ~'maximum value', |
samer@11 | 6 % -> [[D]->[M]] ~'size D array of numbers in 1..M'. |
samer@11 | 7 % |
samer@11 | 8 % The size is specified as in the RAND function, except that if |
samer@11 | 9 % only one dimension is given, we create a vector, not a square |
samer@11 | 10 % matrix, eg |
samer@11 | 11 |
samer@15 | 12 X=1+floor(M*rand); |
samer@11 | 13 |