Re: TIB: Random Number Generation Different From The One Before


[Prev][Next][Index][Thread]

Re: TIB: Random Number Generation Different From The One Before




here's my way, essentially you have all the values in a list already 
then you "shuffle" them. this way you can have lists that aren't 
sequential if you dont want and you can specify the shuffeledness.

:seq(A,A,1,24\->\L		; initial list
:for(A,1,50)				; number of times to shuffle
:ipart (24rand)+1\->\B
:ipart (24rand)+1\->\C
:L(B)\->\D				; swap the two positions
:L(C)\->\L(B)
:D\->\L(C)
:end

> 
> On the 86, how do I get a random integer between 1 and 24, and then if the
> number has already been used, it can't be used again?  Is there any shorter
> way than testing all the numbers prior to it for the chosen number?  Please
> don't waste mine and your time by telling me you don't have an 86.  Thanks in
> advance.
> 
> Glen
> 




References: