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 221 or 112 till
both the values appear and for 3 it should be 123 or 3331112.i
On 23-Oct-08 19:58:12, hiphop wrote:
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 221 or 112 till both
the values appear and
hi
thanks for the reply
actually am supposed to generate random numbers in oncreasing size.
so when i say 1,2 i should get something like 1 or 221 or 1112 ...i
should get both the values 1 and 2 in a random order but it should stop when
both the values occur atleast once in the sequence.so
below i think semi does what you want but it's never going to repeat a
value because it's sampling without replacement ? in that sense,
it's not as general as what you asked for. if you need the repeating
thing, then i'm not sure how to do that. hopefully someone else does.
lapply(1:30,
4 matches
Mail list logo