Mercurial > hg > trimatlab
view private/randnat.m @ 11:0e0f2805ef9c
Added new mechanism for checking Markov chains for uniqueness of stationary distribution;
new supporting files and new parameters to mt_init (see CHANGES).
Some functions require greater Matlab library, not included.
author | samer |
---|---|
date | Sun, 26 Feb 2012 23:11:10 +0000 |
parents | |
children | a6d5597bd922 |
line wrap: on
line source
function X=randnat(M,varargin) % randnat - Draw Random natural numbers from uniform distribution % % randnat :: % M:natural ~'maximum value', % D:[[1,E]] ~'size of E-dimensional array' % -> [[D]->[M]] ~'size D array of numbers in 1..M'. % % The size is specified as in the RAND function, except that if % only one dimension is given, we create a vector, not a square % matrix, eg % % randnat(10,3) :: [[3,3]->[10]]. % randnat(20,2,5,7) :: [[2,5,7]->[20]]. % randnat(20,5) :: [[5,1]->[20]]. X=1+floor(M*rand(tosize(varargin{:})));