Page 1 of 1
REAL random numbers?
Posted: Mon Oct 17, 2011 7:31 am
by infinte
Using CryptGenRandom or /dev/random?
Maybe a mixed implementation between real and pesudo.
Re: REAL random numbers?
Posted: Mon Oct 17, 2011 7:47 am
by rude
Re: REAL random numbers?
Posted: Mon Oct 17, 2011 7:48 am
by Taehl
/dev/random isn't quite as good as many people think... And CryptGenRandom is only pseudorandom (very good pseudorandom, yes, but still not true random).
What do you need true random numbers for, anyway?
Re: REAL random numbers?
Posted: Mon Oct 17, 2011 12:01 pm
by vrld
On Linux, /dev/random should generate random bits by using the user input and other external sources, so there should be no underlying computation method to get these bits. But: Depending on how you interpret these bits, you can get different random distributions other than the
uniform distribution (each number is equally likely to be drawn), meaning that some numbers are more likely to occur than others. The numbers are still "really" random though.
So, what do you mean by "real" random numbers? Numbers that are drawn from a uniform distribution with no underlying computation scheme?
BTW: Randomness often defies intuition. Watch this:
Re: REAL random numbers?
Posted: Mon Oct 17, 2011 2:49 pm
by adnzzzzZ
Re: REAL random numbers?
Posted: Mon Oct 17, 2011 4:50 pm
by Taehl
vrld wrote:So, what do you mean by "real" random numbers?
Real random numbers depend on having sufficient entropy to make bits out of. /dev/random pulls entropy from sources like tiny system temperature and voltage fluctuations and CPU usage at various points in time, which is a great idea. However, patterns sometimes show up even in inputs like those, meaning the pool is getting less entropy than /dev/random assumes it is.
Don't get me wrong, /dev/random is probably the highest-quality randomness you can get without specialized hardware. But I, personally, wouldn't want to trust it 100% completely.
Re: REAL random numbers?
Posted: Mon Oct 17, 2011 8:29 pm
by bartbes
True randomness can't be generated.
Disprove me, if it is influenced by anything (which it should if it doesn't wants to be a calculation), it is by definition something that can be influenced, meaning it's not
truely random. At some point you just have to give in
.
Re: REAL random numbers?
Posted: Mon Oct 17, 2011 10:01 pm
by kikito
Sure.
(source)
Now seriously - as Bartbes says, generating really random numbers isn't very practical on your average computer.
Is there a reason why the "standard" approach isn't good enough for you? I mean this one:
Code: Select all
function love.load()
math.randomseed( os.time() ) -- you call this once at the begining of your program
end
function love.update()
...
local myRandomNumber = math.random()
...
end
Maybe if you tell us why it isn't enough for you, we can help you find a solution that, while not purely random, is good enough for you.