The Magic Café
Username:
Password:
[ Lost Password ]
  [ Forgot Username ]
The Magic Cafe Forum Index » » Puzzle me this... » » From 1 to 1,000,000,000! (0 Likes) Printer Friendly Version

Scott Cram
View Profile
Inner circle
2676 Posts

Profile of Scott Cram
I had my computer choose a random number from 1 to 1,000,000,000. I then had my computer choose a second random number from 1 to 1,000,000,000. After that, I noticed something amazing.

I multiplied the two random numbers together, and noticed that, purely by coincidence, that the product was exactly 1,000,000,000! This was very unexpected, because neither of the numbers had a zero anywhere in them.

What were the two random numbers chosen by the computer?
Nir Dahan
View Profile
Inner circle
Munich, Germany
1390 Posts

Profile of Nir Dahan
I'd go with

512 (2^9 - 9 zeros for each one we divide by two)
and 1953125
landmark
View Profile
Inner circle
within a triangle
4692 Posts

Profile of landmark
Nice problem and answer. BTW, I'm told that getting a truly random number on a computer is actually a very difficult task. Can someone elaborate on that?

Thanks,
Jack Shalom
MacGyver
View Profile
Inner circle
St. Louis, MO
1419 Posts

Profile of MacGyver
Ok, I will.


A computer has no room for "randomness", it simply does what it is told.

You can't just say "give me a random number".

What actually happens, is that someone writes an algorithm that takes in one number, and gives another number that should have no link to the first number, and if you feed THAT number into the algorithm, then you get another number.

If you repeat this process on a "good" algorithm for a long enough time, then the results should be spread out just like true random numbers would be.

The first number given to the algorithm is called a "seed" and for most computer programs, it is usually the system time.

An algorithm gives predictable results.... if you know the seed, then you can find out the whole string of random numbers that a certain algorithm will produce.

If you run two programs that use supposedly "random" values at the exact same second, and they use the same random algorithm, then they will produce identical sequences of numbers.


That's the short end.... what it means is that there is no "random" on a computer, there is only predictable results, which is dubbed "psuedo-random".


Now a simple way around this would be to make the seed contain many things, like the current time, perhaps some values of stock from the stock market, the last 100 letters to be typed in on that computer, ect,ect ect.

But the problem still is that if you can figure out the equation someone is using, and their seed, then you can predict what random numbers will come out before they do.

This used to be a popular form of cheating in online games, because you could predict which way a dice would fall or what number would be generated and base your opinions off that....

Of course, with good software design, today things like that don't happen as much, since there are stronger ways to get random numbers.

The problem is that sometimes it can be very easy to crack someone's algorithm and when you deal with money or other property, that isn't something you can risk.

There are people that sell cd's full of streams of random numbers generated by people who's entire job is to generate those random numbers.

A good fictional story of code breaking is in one of my favorite books, Cryptinomicon.

Basically back in the ww2 there were many differnt cyphers being used, and a popular hard to break one was a "one time pad" which was basically un-breakable because each "key" was random.

In this fictional story, a german code breaker figured out some patterns in the one way keys, such as they had the same person pick out wooden balls with letters on them from a lotto machine, and used them for the key. The code breaker figured that this person was able to sub-consciously feel the balls difference to eachother, and could tell which letter was which out of the corner of her eye or just by weight.... And as a result, would intentionally pull out letters that hadn't been used recently, in order to give it a more "random" look, but this pattern was predictable and he could break the codes by using it.

A far-fetched story(imho), but it goes to show you why generating truly random numbers is not only hard, but very important.



Anyway, some popular solutions exist, such as:

-Taking video of a lavalamp, theorectically its random(probably not though) and since each picture would have a different shape, you could hash each picture and come out with a random number.

-If you put the cap on a digital camera but leave it running, the CCD will pick up "noise" in the pitch black. It is also currently believe by many to be random, or at the very least be impossible to predict. So you could take a picture of this random noise, and use it as a seed, in order to generate some random numbers.


It's a lot easier today than it was many years ago, but who is to say what is truly random???

I personally think that there is no such thing as randomness except when dealing with half-life decay, radiation and some quantom mechanics, but that is just because we don't have the right tools to measure and predict them yet....

Anyway, you could right books on this subject.... but basically its impossible because a computer has no idea what "random" is, it can only perform calculations that you give it.
Nir Dahan
View Profile
Inner circle
Munich, Germany
1390 Posts

Profile of Nir Dahan
MacGyver,

very detailed analysis.
A small addition - some machines take very accurate measurements of temprature. This in turn is used as a seed.

Nir
The Magic Cafe Forum Index » » Puzzle me this... » » From 1 to 1,000,000,000! (0 Likes)
[ Top of Page ]
All content & postings Copyright © 2001-2019 Steve Brooks. All Rights Reserved.
This page was created in 0.18 seconds requiring 5 database queries.
The views and comments expressed on The Magic Café
are not necessarily those of The Magic Café, Steve Brooks, or Steve Brooks Magic.
> Privacy Statement <

ROTFL Billions and billions served! ROTFL