This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

srand() / rand()

Hello,

Is there a way to have real different random numbers?
For the moment, I'm using the rand() function, but this one is generating the same sequence over and over again. I have to unpower my application to have a new series of random numbers.
I'm now 'experimenting' (what's in a word...) with the following construction:

.
.
.
srand( rand() );
.
.
.
RandomNumber = ( rand() / 256 );
.
.
.

Is there a better way to do this?

Rgds,

--Geert

Parents
  • As long as you ask the forum exactly the same question to start, the sequence of replies you get will be exactly the same. A slightly different question would produce a different sequence, though. It's all about where you start.

    The answer generator on the board has some statistical flaws, though. My analysis of the threads shows an extremely high rate of appearance of the value "Have you read the Manual?". It's not a uniform distribution at all.

Reply
  • As long as you ask the forum exactly the same question to start, the sequence of replies you get will be exactly the same. A slightly different question would produce a different sequence, though. It's all about where you start.

    The answer generator on the board has some statistical flaws, though. My analysis of the threads shows an extremely high rate of appearance of the value "Have you read the Manual?". It's not a uniform distribution at all.

Children