• ARTICLES
• SUBSCRIBE
SEARCH

## RND() question

(2 posts)
• Started 9 months ago by GBJIMANDREWS
• Topic Viewed 223 times

GBJIMANDREWS
Posts: 1

Back in the day of peeks, pokes and calls in BASIC, there was a seed location for the rnd() function.

Went something like this:
poke(XX1) 1
poke(XX2) 1
poke(XX3) 1
poke(XX4) 1
poke(XX5) 1

This put the value 1 into those locations, then
int(rnd(0;255))
would return an integer value between 0 and 255, say, 92.
another int(rnd(0;255)) would return 219, and a third int(rnd(0;255)) would return 47.

Poking 1s into those locations again and another 3 calls to int(rnd(0;255)) would produce the same series of 'random' numbers; 92, 219 and 47.

Question;
Does anyone know of a similar situation where the rnd() return will be predictable?
I have just retired and have always wanted to complete an encryption proggy with this as the core, but have progressed to C++, VB and C#.

xxxxxxx@xxxxxxxxxxxxxx

Edit Email addresses are not allowed in posts. All answers will be provided here in this topic. -- GModX

Posted 9 months ago #

raphoenix
Posts: 14920

In VB, to repeat a sequences of random numbers, call Rnd with a negative argument immediately before using Randomize with a numeric argument.

We have Two Members who really know plus practice VB and Scripting so may be they will answer also.

Posted 9 months ago #

## Topic Closed

This topic has been closed to new replies. Please create a new topic instead.