Click to See Complete Forum and Search --> : Rnd function


AndyK
June 4th, 2000, 10:39 PM
how to rendomize between selected numbers. Like if 1,4,8,3 were picked, how to randomize between those 4 numbers. I just can get it, but it should be easy.
Thanks

Programs and requests for them for FREE.
http://falstok.fly.to

dhstraayer
June 5th, 2000, 06:50 PM
I think what you are looking for is to put the "n" target numbers into an array. Say as elements 0,1,...(n-1). Then you take int(n*rnd).

Something like:

Dim List()
Dim n as Integer
Dim i as Integer
n = GetAValueofN()
for i = 0 to n - 1
List(i) = GetAValueofList()
next i
Randomize
ARandomSelection = List(n * Rnd)



where the functions GetAValueofN and GeetAValueofList do what they say.



Dave Straayer
Varatouch, Inc.