views:

85

answers:

2

Hi,

I have a question. How can I calculate/estimate upper bound of random number, that a random number can generate ? Thanks in advance!

A: 

Random Number generators will generate a number between 0 and 1. The real limiting factor is the precision of your platform/framework. The upper/lower bounds will be whatever the min/max of the data type you convert the 0-1 value to.

David
What you write might be true in some cases, but certainly not all. The random number generators in a game of craps, for instance, output a number between 1-6 inclusively.
ladenedge
The statement is valid. In this proposed craps framework, the 0-1 number generated is converted to a type that limits values to whole numbers between 1 and 6. In this case the precision of the generator will likely never be a problem as the target range is trivial.
David
Wrong, David. Sometimes the generator generates an integer between 0 and MAX. Take, for instance, the `rand()` function from standard C library.
Denilson Sá
@David: I'm not talking about a 'craps framework', I'm talking about the game of craps, which uses two random number generators. (FWIW, if you did happen to have an RNG that generated a number 0-1, simulating a six-sided die *would* be subject to the precision of your CPU because there is no finite real representation of 1/6.)
ladenedge
@David - I propose that your view of all random numbers between in the range [0,1] is incorrect. There are actually little imps in the computer which roll dice (lots of them) and then convert the output to the range [0,1].
Donnie
A: 

thanks for answers ! With upper bound I mean the number of distinct values that the RNG generates. The random number generator is based on a hashfunction.

wano3