[R] R random number generation

hiphop bspring28 at gmail.com
Thu Oct 23 21:58:12 CEST 2008


i have to generate random numbers from length 2 to 30 and length two should
have the numbers 1,2 and length 3 should have the numbers 1,2,3 so on and so
forth till size 30.i should get an sequence like 2222221 or 1111112 till
both the values appear and for 3 it should be 1222223 or 3331112.i should
get similar output for all sizes which means i should get 30 sequences.but
am getting only one sequence .please help.
this is my code

y=0;
for (i in 1:3)
{
while(y!=i)
{
y=sample(1:3,replace=TRUE);
}
}

-- 
View this message in context: http://www.nabble.com/R-random-number-generation-tp20138441p20138441.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list