Using CryptGenRandom or /dev/random?
Maybe a mixed implementation between real and pesudo.
REAL random numbers?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: REAL random numbers?
/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?
What do you need true random numbers for, anyway?
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Re: REAL random numbers?
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:
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?
Last edited by adnzzzzZ on Tue Oct 10, 2017 6:30 pm, edited 1 time in total.
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: 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.vrld wrote:So, what do you mean by "real" random numbers?
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.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: REAL random numbers?
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 .
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 .
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: REAL random numbers?
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:
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.
(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
When I write def I mean function.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 4 guests