• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Random numbers

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

PolyPill

Senior Member
Joined
May 20, 2001
Location
Germany
It seams to me like all random number generators aren't very random. The middle numbers, 3-7 get picked more often than the others and it really annoys me. Anyone know of a good way to make it more random?
 
There are several ways people come up with "random" numbers. I say "random" because they are just a sequence of numbers started off with a seed number. Having the same seed will generate the same list of "random" numbers. Look on the web for Number Theroy and Random. It should turn up a few results.

The only way I can remeber off the top of my head is a squaring trick. Basicly, you give me a number, and I square it. The two middle digits are now the new number to square. This creates a "random" sequence, except in a few cases which will lead you to squaring the same number over and over.

JigPu
 
A good way for REALLY random numbers is involving a user input. Simplest being a loop that counts numbers from the range really fast (like 1000 of times in second). Going like 1 2 3 1 2 3 1 2 3 range being 1-3. The loop will stop as soon as U hit a key. Idea is that the high speed of counting takes all things like yer muscle tiredness and keyboard condition etc. into the "randomnes".

Taking several random numbers can result in similar numbers if the speed is not fast enough and the user can tap the keys in fine intervals.

To make it uber random, combine this with the algoritmic random values discussed by the earlier poster.
 
Back