Random number generation

Shivani R shivani.shivipr at gmail.com
Fri Apr 9 17:01:00 UTC 2010


Hi,

Thanks David and Michiel for all your help and time. I am trying out
this logic in the experiment.


Thanks again.


Regards
Shivani

On Apr 9, 5:32 am, Michiel Spape <Michiel.Sp... at nottingham.ac.uk>
wrote:
> Hi,
> What David said, or: just shuffle an array with the numbers 1 to 100.
>
> Dim i as Integer
> Dim Rand100(1 to 100) as Integer
> For i = 1 to 100
>         Rand100(i) = i 'fills array
> Next i
>
> RandomizeArray Rand100 'randomises
>
> For i = 1 to 100
>         Debug.Print "Random number is = " & Rand100(i) 'show output
> Next i
>
> Michiel Spapé
> Research Fellow
> Perception & Action group
> University of Nottingham
> School of Psychology
>
>
>
> -----Original Message-----
> From: e-prime at googlegroups.com [mailto:e-prime at googlegroups.com] On Behalf Of Shivani R
> Sent: 09 April 2010 03:12
> To: E-Prime
> Subject: Random number generation
>
> Hi,
>
> 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 athttp://groups.google.com/group/e-prime?hl=en.
>
> This message has been checked for viruses but the contents of an attachment
> may still contain software viruses which could damage your computer system:
> you are advised to perform your own checks. Email communications with the
> University of Nottingham may be monitored as permitted by UK legislation.- Hide quoted text -
>
> - Show quoted text -

-- 
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