Larget Random Number Seed
Author Message
Larget Random Number Seed

Hi all.

Question 1.
I was wondering what the largest seed you can give to randomize to
produce a unique set of random numbers?

Question 2.
My project calls for an initial seed and the same set of random
numbers generated, but I need many unique and repeatable sets.
Perhaps I can seed 2x and produce a unique repeatable set that way.
For instance could I loop

for x=0 to 100
for y=0 to 100
Randomize -1
Randomize x:Randomize y
gosub extract_unique_repeatable_set_length_of_10
next y
next x

Will this repeat the same set given all values for x and y??

My third question *was* what would happen if you seed the generator
with a say, 7 and then another number say, 3 and then 7 again.  Will
the 7 seed repeat the 7 seed sequence?  The answer to that was no, but
apparently if you seed with a negative number first and then seed with
the positive 7 it will get the same sequence for 7 seed.

Thanks very much.

Sean Lorber

Fri, 15 Oct 2004 10:39:54 GMT
Larget Random Number Seed
...Questions about generating repeated sequences of random numbers
within VB...

Randomize [number]

The optional number argument is a Variant or any valid numeric
expression.

Remarks
....
Note   To repeat sequences of random numbers, call Rnd with a negative
argument immediately before using Randomize with a numeric argument.
Using Randomize with the same value for number does not repeat the
previous sequence.

Quote:

> Hi all.

> Question 1.
> I was wondering what the largest seed you can give to randomize to
> produce a unique set of random numbers?

Largest seed will be largest valid number for the type you provide
(apparently)...

Quote:
> Question 2.
> My project calls for an initial seed and the same set of random
> numbers generated, but I need many unique and repeatable sets.
> Perhaps I can seed 2x and produce a unique repeatable set that way.
> For instance could I loop

>    for x=0 to 100
>    for y=0 to 100
>    Randomize -1
>    Randomize x:Randomize y
>    gosub extract_unique_repeatable_set_length_of_10
>    next y
>    next x

> Will this repeat the same set given all values for x and y??

Well, no, the call using y doesn't immediately follow a call with -1 so
it will be a non-reproducible sequence and if (as I assume there must
be) there is a call to rnd() in sub extract_... it will not be a
repeated sequence anyway...

What about generating the sets once and simply read them in from a
binary file---I'm assuming from the sub title that you're talking about
small sets....of course, if they're small enough you could just populate
a 2D array and keep them in memory...

But as I read the doc, all you got's to do is call w/-1 and follow that
with a particular seed to regenerate the sequence....about two simple
tests ought to confirm/deny that behavior.

Fri, 15 Oct 2004 22:42:29 GMT

 Page 1 of 1 [ 2 post ]

Relevant Pages