|
|
|
|
|
|
| |
| |
|
|
From: Greg M Johnson
Subject: Re: Can someone research a stupid bug report for me?
Date: 21 Sep 2007 07:55:56
Message: <46f3b14c@news.povray.org>
|
|
|
| |
| |
|
|
andrel wrote:
> Greg M. Johnson wrote:
>> Warp wrote:
>>
>>> 1812433253
>>
>> Fascinating. Makes me want to make up my own from now on.
>>
>> Is something like newrand()= mod (1000* sin( (0.5+0.5*newrand())*pi ) ,
>> 1)
>>
>> less "predictable? Can you think of something better?
> yes.
> weakpoints are that it takes longer to compute than a standard random
> number generator but more importantly, is does not have a flat
> distribution. It is not as bad as I expected (see attached greg1.png)
> but not good enough. I think it is because if your number is close to 1,
> the next will also be. And you can get there by accident, so that is
> probably why there is that peak close to 1. Removing the pi from your
> equation helps a lot. I don't feel like doing a more complete analysis
> now.
Wow, thanks!
And thanks for the pointer to the Mersenne
Post a reply to this message
|
|
| |
| |
|
|
From: Warp
Subject: Re: Can someone research a stupid bug report for me?
Date: 21 Sep 2007 11:24:28
Message: <46f3e22b@news.povray.org>
|
|
|
| |
| |
|
|
Orchid XP v3 <voi### [at] devnull> wrote:
> OOC, are the coeficients for POV-Ray's generator from a book or where
> they just chosen arbitrarily?
Unlikely to be arbitrary because, IIRC, the period is 2^32. (In other
words, it goes through the entire range of 32-bit values before repeating.)
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
From: Orchid XP v3
Subject: Re: Can someone research a stupid bug report for me?
Date: 22 Sep 2007 03:06:46
Message: <46f4bf06$1@news.povray.org>
|
|
|
| |
| |
|
|
Warp wrote:
> Orchid XP v3 <voi### [at] devnull> wrote:
>> OOC, are the coeficients for POV-Ray's generator from a book or where
>> they just chosen arbitrarily?
>
> Unlikely to be arbitrary because, IIRC, the period is 2^32. (In other
> words, it goes through the entire range of 32-bit values before repeating.)
Right. There's some kind of algorithm for picking LCG coefficients such
that they have this property. (I have no idea what the algorithm is.)
So even though you get uniformly distrubuted numbers in 0 .. 1, POV-Ray
is actually generating integers and converting them? Presumably that
means no two random numbers can differ by less than 2^-32?
--
http://blog.orphi.me.uk/
Post a reply to this message
|
|
| |
| |
|
|
From: Warp
Subject: Re: Can someone research a stupid bug report for me?
Date: 22 Sep 2007 05:23:18
Message: <46f4df06@news.povray.org>
|
|
|
| |
| |
|
|
Orchid XP v3 <voi### [at] devnull> wrote:
> So even though you get uniformly distrubuted numbers in 0 .. 1, POV-Ray
> is actually generating integers and converting them? Presumably that
> means no two random numbers can differ by less than 2^-32?
That's correct.
There are also other side-effects. For example, you can have two
random seeds, each one creating random numbers independently of each
other, and suddenly one of them may start giving the exact same values
the other one gave when it started.
This is because every seed is just going through the exact same
sequence of numbers, simply starting at different places. Advance
one seed enough and it will eventually reach the starting point of
the other seed.
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> Orchid XP v3 <voi### [at] devnull> wrote:
>> So even though you get uniformly distrubuted numbers in 0 .. 1,
>> POV-Ray is actually generating integers and converting them?
>> Presumably that means no two random numbers can differ by less than
>> 2^-32?
>
> That's correct.
>
> There are also other side-effects. For example, you can have two
> random seeds, each one creating random numbers independently of each
> other, and suddenly one of them may start giving the exact same values
> the other one gave when it started.
> This is because every seed is just going through the exact same
> sequence of numbers, simply starting at different places. Advance
> one seed enough and it will eventually reach the starting point of
> the other seed.
And I presume it's a bad idea to choose different LCG coefficients for each
seed?
Rune
--
http://runevision.com
Post a reply to this message
|
|
| |
| |
|
|
From: Warp
Subject: Re: Can someone research a stupid bug report for me?
Date: 22 Sep 2007 07:29:40
Message: <46f4fca4@news.povray.org>
|
|
|
| |
| |
|
|
Rune <new### [at] runevisioncom> wrote:
> And I presume it's a bad idea to choose different LCG coefficients for each
> seed?
Not really, if each one has the same quality. POV-Ray just doesn't do
that.
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |