PDA

View Full Version : Fun with random numbers


mlseim
07-04-2005, 04:49 AM
... post removed ...


..."I guess it's not as much fun as I originally thought."

Jeff Mott
07-04-2005, 06:00 AM
Apparently, there's some problems with the way computers generate random numbers, especially doing it yourself with "srand" and "rand"This "problem" that you're speaking of is that computers actually generate psuedo-random numbers. The random looking numbers that come out of a PRNG (psuedo-random number generator) are calculated, which means they are reproducable given the necessary information of how to start. In cases such as simulations this is a good thing (so you can retry or reproduce a particular simulation); in cases such as crypography and password generation this is a bad thing (you don't want attackers to be able to reproduce a key or password); in cases such non-ultra secure sites, games, or coin tosses a PRNG is more than adaquate. (You could have learned all this on your own if you read the introduction and random.org.)

So in the case of coin tosses using the rand function would be a better choice simply because having to send an HTTP request and then wait for the response is going to take far more time than calling a built-in function.

bazz
07-04-2005, 08:58 PM
(You could have learned all this on your own if you read the introduction and random.org.)

Seems a bit of a terse remark when, after all, he did post a link to random.org and in any case, was only trying to offer something of a pointer to anyone who may have been trying to do what was in the thread he also referred to.

Not biting you, but sometimes posts read differently, from how the author intended. ;)

Bazz

Jeff Mott
07-04-2005, 10:28 PM
I'm sure it did come through a bit terse. It irks me when people jump to solutions without taking the time to read and learn how things work and why they work, which allows them to know when something should or should not be used.

Like an HTML coder who discovers that the image alt attribute results in a tooltip in IE. All they know or care about is that they found something new and cool; never bothering to learn just a little bit more to discover that they are using it in the wrong way and for the wrong reason.

The "problem" of PRNGs is only a problem under very specific circumstances. And the numbers from random.org have their own problems under those circumstances, which is explicitly stated and explained at random.org. mlseim's description of the situation made it almost obvious that he didn't take much time to read and understand the information from the very site he referenced.

This is why there are so many books, tutorials and articles on so many subjects (such as HTML or Perl, for example) that contain incomplete or incorrect information—because there are so many people who decide to teach before they bother to learn. mlseim's post is certainly a much smaller and far less severe instance of this, but it certainly did annoy me when I saw it happening right in front of me.

So yes, the response was a bit terse. I specifically made it that way in order to emphasize the point.

Jeff Mott
07-05-2005, 07:52 PM
... post removed ...
..."I guess it's not as much fun as I originally thought."It is an interesting topic, but you have to be willing to read the information that is available.

I didn't mean to go all out like I did in my previous post. I meant to just have that one terse sentence in my first reply to make the point and leave it at that. I don't mean to discourage you.