Rnd problems !! 
Author Message
 Rnd problems !!

when i launch a rnd fonction like

x = Rnd

I get a number (ex: 0.55632)

but If I stop the prog and re-launch, I get the same number ????

any idea ?

thx by advance.



Fri, 13 Sep 2002 03:00:00 GMT  
 Rnd problems !!
This should give you what you want.
Randomize
x = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)

--
Regards, Kim.

Kim Major - Visual Basic MCP.
=============================================
Renaissance Computer Systems LTD.

An entity is in Third Normal Form if every non-key attribute
depends on the key, the whole key and nothing but the
key, so help me Codd.
=============================================

Quote:

> when i launch a rnd fonction like

> x = Rnd

> I get a number (ex: 0.55632)

> but If I stop the prog and re-launch, I get the same number ????

> any idea ?

> thx by advance.



Sun, 15 Sep 2002 03:00:00 GMT  
 Rnd problems !!
Kim,
Your solution is useful to generate the number between a fixed bound. But I
believe the problem collo is facing is different.

Collo,
Random numbers generated by Rnd is not atually random. Its a very long list
of pre-determined numbers. Hence you are facing the problem.
The app starts getting numbers from the first element.
HELP: Randomize. Randomize statement makes the Rnd function to start "NOT"
from the first element. But you will again end up with the same problem, if
you start the app with a statment like Randomize 10 (or anything else).
HELP: Timer. Timer returns the clock system value. Even though it is a
sequence, it will never repeat a value.
So, try this.

Randomize Timer
MsgBox Rnd

If you put the statement "Randomize Timer" at the start of the app instance,
then getting repeated sequences is minimal. But if you execute this
statement at the begining of the sub-routine, then getting repeated
sequences is even minimal. But if you execute this statement before each
call to Rnd, then getting repeated sequences is as good as a zero
possibility.

Thanks.


Quote:
> This should give you what you want.
> Randomize
> x = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)

> --
> Regards, Kim.

> Kim Major - Visual Basic MCP.
> =============================================
> Renaissance Computer Systems LTD.

> An entity is in Third Normal Form if every non-key attribute
> depends on the key, the whole key and nothing but the
> key, so help me Codd.
> =============================================


> > when i launch a rnd fonction like

> > x = Rnd

> > I get a number (ex: 0.55632)

> > but If I stop the prog and re-launch, I get the same number ????

> > any idea ?

> > thx by advance.



Wed, 18 Sep 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Rnd problems and Error 401 problems

2. a little RND problem

3. Subject: a little (DICE rolling and LOTTO picker) RND problem

4. Date And RND problems

5. Rnd function problem

6. Rnd function problem

7. Problems using Randomize, Rnd

8. RND() not random when used in ASP - Clarification

9. RND password generator.

10. RND Random VBA (want to exclude)

11. Rnd

12. routines that use RND

 

 
Powered by phpBB® Forum Software