POV-Ray : Newsgroups : povray.off-topic : Can someone research a stupid bug report for me? Server Time
11 Oct 2024 15:20:02 EDT (-0400)
  Can someone research a stupid bug report for me? (Message 17 to 26 of 26)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Greg M  Johnson
Subject: Re: Can someone research a stupid bug report for me?
Date: 20 Sep 2007 21:32:12
Message: <46f31f1c@news.povray.org>
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?


Post a reply to this message

From: Warp
Subject: Re: Can someone research a stupid bug report for me?
Date: 21 Sep 2007 04:22:07
Message: <46f37f2f@news.povray.org>
Greg M. Johnson <pte### [at] thecommononethatstartswithycom> wrote:
> Can you think of something better? 

  Yes, the Mersenne twister.

-- 
                                                          - Warp


Post a reply to this message

From: andrel
Subject: Re: Can someone research a stupid bug report for me?
Date: 21 Sep 2007 04:27:40
Message: <46F3817C.9020901@hotmail.com>
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.


Post a reply to this message


Attachments:
Download 'greg1.png' (4 KB) Download 'greg2.png' (5 KB)

Preview of image 'greg1.png'
greg1.png

Preview of image 'greg2.png'
greg2.png


 

From: Orchid XP v3
Subject: Re: Can someone research a stupid bug report for me?
Date: 21 Sep 2007 07:04:08
Message: <46f3a528$1@news.povray.org>
Warp wrote:

>> Can you think of something better? 
> 
>   Yes, the Mersenne twister.

Results decorrelated to over 12 dimensions... ;-)



OOC, are the coeficients for POV-Ray's generator from a book or where 
they just chosen arbitrarily?

-- 
http://blog.orphi.me.uk/


Post a reply to this message

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

From: Rune
Subject: Re: Can someone research a stupid bug report for me?
Date: 22 Sep 2007 06:11:11
Message: <46f4ea3f$1@news.povray.org>
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

<<< Previous 10 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.