Please put a good PRNG in 0.8.1

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Please put a good PRNG in 0.8.1

Post by kikito »

I knew I had seen it somewhere. Of course, xkcd.
When I write def I mean function.
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Please put a good PRNG in 0.8.1

Post by vrld »

Hexenhammer wrote:
vrld wrote:And by "truly random" sequence you probably mean "high entropy", which is what I wrote in the part you kindly mitted... ;)
No, I thought I made it clear that I wasn't talking about distribution issues at all.
Entropy is a different notion than (but connected to) distributions of random variables, so...
Hexenhammer wrote:randomB(1, 10)
May return: 3,6,7,1,1,3,4,8,9.. and if we call it often enough and measure we find that it returns as many 3s as it return 4s etc. (...) However, this "RNG" actually has the characteristic that a 7 is followed by a 1 much more often than by any other number.
Entropy measures how much new information we get by observing stuff. In this example, the entropy of '7, then 1' (formally: H(7|1)) is less than '7, then 2', because we know that '7, then 1' happens more often than other patterns. In other words, it is more interesting to see '7, then 2'. The ideal RNG has entropy H(x) = 1 for any number in the range. `randomB()` does not have this property.

Looking at it from another angle, randomB() does not produce uniformly distributed numbers, just because '7, then 1' is more likely than '7, then 2'. Formally, we can say that P(1|7) > P(2|7), which translates to: the probability of 1 given that we know 7 came before is bigger than probability of 2 given that 7 came before. This violates the 'uniform' characteristic: If `randomB()` returned uniformly distributed numbers, then the probabilities should be equal. Even stronger, the probability of producing a number must not depend on what number(s) have been drawn before: P(1|7) = P(1) = P(2) = P(2|7) (statistical independence).

I think we are talking apples and oranges here. Or we have different definitions/names for basically the same thing.
Anyway, this discussion is getting slightly out of hand. Should we be writing PMslove letters instead?

Edit:PMs -> Love Letters
Last edited by vrld on Fri Feb 22, 2013 6:38 pm, edited 1 time in total.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Please put a good PRNG in 0.8.1

Post by bartbes »

vrld wrote:Should we be writing PMs instead?
That reminds me, why are they not named "love letters"?
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Please put a good PRNG in 0.8.1

Post by Lafolie »

bartbes wrote:
vrld wrote:Should we be writing PMs instead?
That reminds me, why are they not named "love letters"?
That would necessitate a pink envelope icon, yay.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
User avatar
slime
Solid Snayke
Posts: 3170
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Please put a good PRNG in 0.8.1

Post by slime »

bartbes wrote:
vrld wrote:Should we be writing PMs instead?
That reminds me, why are they not named "love letters"?
"I consider, that you commit an error. Write to me in love letter"

hmm...
User avatar
Hexenhammer
Party member
Posts: 175
Joined: Sun Feb 17, 2013 8:19 am

Re: Please put a good PRNG in 0.8.1

Post by Hexenhammer »

vrld wrote: Anyway, this discussion is getting slightly out of hand.
Agreed. I could continue it by arguing against your definition of "uniform distribution" for starters but I have other things to do too - like continuing to develop my first LÖVE game :ultraglee:

The original point of this thread - me petitioning for a different PRNG implementation - was already addressed so I will just let this issue rest here :cool:
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests