Random Numbers

C

Clark S. Cox III

Frederick said:
Kai-Uwe Bux posted:



When the Big Bang occurred, molecules and atoms and so forth got flung out in
ever direction -- the resultant collisions and changes in trajectory resulted
in the formation of you as an organism, and resulted in your choice of 2.

So you see, it wasn't random. ;)

You assume that this is the only universe, and that there isn't some
universe somewhere where he chose a different number :)
 
K

Kai-Uwe Bux

Clark said:
You assume that this is the only universe, and that there isn't some
universe somewhere where he chose a different number :)

Pardon me,


whoever in that alternate universe chose that different number sure wasn't
me. (I would know :)


Best

Kai-Uwe Bux
 
R

Robert J. Hansen

Frederick said:
While we're being pedantic -- there's no such thing as a random number.

While you'll always get some determinism from your measuring apparatus,
radioisotope decay is random enough for virtually any purpose. Many
crypto accelerator cards nowadays use radioisotope decay for their
built-in RNGs.
 
P

Pedro Sousa

Frederick said:
Robbie Hatley posted:



The twin casts are slight overkill (in my opinion):

inline
double RandNum(double const min,double const max)
{
return (max-min) * rand() / (RAND_MAX+1) + min;
}

Or, if you would prefer the division to take place before the multiplication:

return (max-min) * (rand() / (double)(RAND_MAX+1)) + min;

There exists good books about random numbers.

A well know book is "Numerical Recipes" which is free of charge on the
Internet and has implemented algorithms. There exists an chapter only
for random numbers and it explains very well the theory.

Besides discussing, you can go and read the book for a better view of
what is a random number.
 
P

Philipp

Frederick said:
When the Big Bang occurred, molecules and atoms and so forth got flung out in
ever direction -- the resultant collisions and changes in trajectory resulted
in the formation of you as an organism, and resulted in your choice of 2.

So you see, it wasn't random. ;)

Although I see that the discussion is gowing in the direction of fun, I
would like to point out that the evolution is not entirely determined by
it's initial state.
This is what quantum theory told us and which opposes to the view of
physics at the end of the 19th century when people thought that
everything can be predicted when the initial state is know precisely
enough...

So yes there exists (at the present knowledge) am experiment which can
yield a true random number.

Phil
 
J

Jerry Coffin

[email protected] says... said:
IOWs, random is random :)

More completely, "random as far as we can tell" is random.

Somebody who chooses to do so can argue that a deity or perhaps another
race somewhere else in the universe might be able to predict things like
radioactive decay with perfect accuracy -- and I'm certainly not in a
position to disprove that possibility. At the same time, until or unless
WE can figure out how to do so, such a sequence is random for any
practical purpose.
 
C

Chris Theis

Pete Becker said:
Where in the standard is this requirement? <g>

Well, there isn't and that might be the source of the problem. On the other
hand the question arises whether it is the business of a language-standard
to require certain quality levels for a RNG?
Many years ago, there were many bad implementations of rand. There still
may be.

Oh there certainly are. However, there is also a plethora of non rand() RNGs
which one should better send to /dev/nul.

Cheers
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,770
Messages
2,569,588
Members
45,095
Latest member
EmiliaAlfo

Latest Threads

Top