[eu-gene] ansi randomness

Dave Griffiths dave at pawfal.org
Wed May 10 11:01:18 BST 2006


> Rob Myers said :
>> On 9 May 2006, at 22:03, \jjs wrote:
>>
>> >but that MinGW implementation seems completely deterministic to me!
>> >for instance- how can you get a number between 0 and
>> >6364136223846793006 [unless you can feed it a floating point number
>> >between 0 and 1]?
>>
>> I'm guessing there's an overflow involved which will wrap the number
>> round.
>
> i think Pd's [random] is also using overflow to get the "random" number.
> or at least the code for the
> [random] object in pd is very short too.

I don't know if it's what the random object uses, but in:
http://cvs.sourceforge.net/viewcvs.py/pure-data/pd/src/x_misc.c?view=markup

in random_bang() line 63:

randval = randval * 472940017 + 832416023;

interestingly the seed is generated from another random generator which
itself is seeded from a constant value.

>> Anyone on the list who can guess the next number a pseudorandom
>> number will generate is better at maths than me. That said, anyone
>> who can do long division is better at maths than me. :-)

that's exactly the point I think - I just want to emphasise that there is
no mystical magic involved with randomness on a machine, the magic is the
breakdown of our own pattern recognition - and the ability for us to find
patterns within that which have nothing to do with the mechanics of the
computer - that is interesting.

cheers,

dave



More information about the eu-gene mailing list