A86: Re: Creating distinct random-integer lists using ASM or BASIC


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

A86: Re: Creating distinct random-integer lists using ASM or BASIC





On Fri, 2 Oct 1998 19:50:29 -0400 "Dux Gregis" <assets@eden.rutgers.edu>
writes:
>
>
>In basic you can use rand to get a number between one and 10, scan 
>through
>the list and if your integer is there already, rerandomize the int and 
>scan
>again.

no!  you fill a list with all the numbers in the range and shuffle!
say you want 1-10, you fill the list with
{1 2 3 4 5 6 7 8 9 10}
then you pick two places at random, say 3 and 8, and swap them
{1 2 8 4 5 6 7 3 9 10}
then you repeat this several times.


-josh


>
>
>>
>>I'll try to be as clear as possible on this.
>>
>>Is there anyway somebody can create a list of random integers with an
>inputted
>>range?....sort of like putting the integers within the range in 
>random
>order.
>>
>>For example, if you input 1 and 10.  It should generate a 10 item 
>list of
>>numbers from 1 to 10 that are randomly placed something like:  {5, 3, 
>8, 9,
>2,
>>1, 7, 6, 4, 10}.
>>
>>If someone knows of any optimal way of programming this either in 
>basic or
>>asm, preferably in asm then I'd greatly appreciate it.  this will 
>come in
>use
>>when taking statistics courses since sometimes you have the assign 
>the
>>experimental units random numbers in order to invalidate the lurking
>variable
>>of nonrandom assigning.
>>
>>Reply to this list.
>>
>>
>>Thanks,
>>
>>Mohsan H.
>
>

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]


References: