Random number generation

dkmcf mcfarla9 at msu.edu
Fri Apr 9 03:30:00 UTC 2010


Shivani,

Simply put, you want to draw the numbers 1-100 in a shuffled order.
Easiest to do this making a List with the numbers 1-100, setting the
List to Random, then drawing samples from the List, perhaps as a
nested List.  Please work through the appropriate tutorials in the
manuals that came with E-Prime, with particular attention to Appendix
C of the User's Guide.  But if you would really rather roll your own
than use a List, then you want to program a Fisher-Yates shuffle
algorithm, just look that up on Wikipedia.

-- David McFarlane, Professional Faultfinder


On Apr 8, 10:11 pm, Shivani R <shivani.shiv... at gmail.com> wrote:
> I am working on an experiment in which I want to generate 100 random
> numbers between 1 - 100, but a number should not be repeated. Say if 1
> is generated then it should not be generated again. Basically I want
> all 100 numbers between 1 and 100 without any repetetion and that too
> in a random manner.
>
> Right now I am using the script
>
> Dim i as Integer
> Dim Rand as Integer
>
> For i = 1 to 100
>
> Rand = Random(1,100)
>
> Debug.Print "Random number is = " & Rand
>
> Next i
>
> This is giving me random numbers between 1 and 100, but the numbers
> are repeated.
>
> Please let me know if there is any logic of generating random numbers
> without any repeat.
>
> Any help is really appreciated.
>
> Regards
> Shivani

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list