Publisher review:RANDP - Random integers with given probabilities. RANDP - random integers with given probabilitiesR = RANDP(P,N) is an N-by-N matrix with random entries on the interval[1,NUMEL(P)], chosen from the distribution specified by P.RANDP(P,M,N) and RANDP(P,[M,N]) are M-by-N matrices with random entries.RANDP(P,M,N,O,...) or RANDP(P,[M,N,P,...]) generate random arrays.RANDP(P,SIZE(A)) is the same size as A.For large N, the ratio "sum(R(:)==i)/sum(R(:)==j)" approximates"P(i)/P(j)" for two integers i and j in the range [1,NUMEL(P)].Examples:% generate a 10000-by-1 matrix with random entries [1,3] in which 1 occurs% about 10%, 2 about 30% and 3 about 60%R = randp([1 3 6],10000,1) ; sum(R(:)==1)/sum(R(:)==3)% should be ~ 1/6% randomly select 100 elements according to a specific distributionV = {'Red','Green','Blue'} ;ind = randp([80 10 10],200,1) ;R = V(ind) ; % should contain about 160 'Red'See also RAND, RANDSAMPLE (Matlab 7 Stats Toolbox) Requirements: ยท MATLAB Release: R13
RANDP is a Matlab script for Statistics and Probability scripts design by Josh.
It runs on following operating system: Windows / Linux / Mac OS / BSD / Solaris.
Operating system:Windows / Linux / Mac OS / BSD / Solaris