|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Peter J. Holzer wrote in message ...
>On 2001-02-07 15:47, Tom Melly <tom### [at] tomandlucouk> wrote:
>>If it is a fixed sequence, how long is it?
>
>2^32.
I think it is actually (2^32)-2
--
Mark
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ron Parker <ron### [at] povrayorg> wrote:
: next_rand[stream] = next_rand[stream] * 1812433253L + 12345L;
: which doesn't look particularly well-chosen to me.
It depends on what you want to do, but basically you are right, it's not
excellent.
There are better methods which give more randomness and much large periods.
For example the C library function (not standard but found in most unix
compilers and perhaps others as well) for random() is described in the
following way:
The random() function uses a nonlinear additive feedback
random-number generator employing a default state array size
of 31 long integers to return successive pseudo-random
numbers in the range from 0 to 2**31-1. The period of this
random-number generator is approximately 16 x (2**31-1). The
size of the state array determines the period of the
random-number generator. Increasing the state array size
increases the period.
If I understand this correctly, it uses a whole array as seed value instead
of one integer. I suppose that this way more randomness is achieved and
a much larger period (16*(2^31-1) is pretty large).
--
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Tom Melly <tom### [at] tomandlucouk> wrote:
> "Ken" <tyl### [at] pacbellnet> wrote in message
> news:3A8182D3.B378D2C3@pacbell.net...
>>
>>
>> Tom Melly wrote:
>> >
>>
>> > Also, is the random number sequence a fixed sequence, with the seed just
>> > controlling the point at which you join the sequence.
>>
>> Yes.
>>
> This resolves all the other questions.
>> > If it is a fixed sequence, how long is it?
>>
>> I don't know.
>>
> Except this one.
Well, most random number sequences these days use the 1/sec > heat death
system. Ie, if you got one number a second, then the sequence would take
longer than the heat death of the universe to repeat. If Pov's isn't this
good, I can get them the code for the Mersenne Twister, which is some
obscene multiple of the heat death criteria, and is also really good
randomly. And it's *fast*, which is also a big plus. We use it for high
end simulation where I work, where time is critical.
Geoff
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Thu, 8 Feb 2001 00:36:36 +0100, Alessandro Coppo wrote:
>*) Park Miller Minimal Standard
>http://htm4.ee.queensu.ca:8000/ling/minrng.html
This one looks good, but it doesn't have any sort of writeup. Is there
another page that goes with this that might include copyright details?
>*) Mersenne Twister, currently the best known
>http://www.math.keio.ac.jp/~matumoto/emt.html, period is 2**19937-1 it's
>not a typo... about 10**6000!!!
We can't use this one at this time as its license is GPL.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <slr### [at] fwicom>, ron### [at] povrayorg
wrote:
>On Thu, 8 Feb 2001 00:36:36 +0100, Alessandro Coppo wrote:
>>*) Mersenne Twister, currently the best known
>>http://www.math.keio.ac.jp/~matumoto/emt.html, period is 2**19937-1 it's
>>not a typo... about 10**6000!!!
>
>We can't use this one at this time as its license is GPL.
I saw the Mersenne Twister described in the latest WebTechniques. It
looked pretty simple. GPL is a copyright, not a patent, as far as I
know. Though I am not a lawyer, I'm pretty sure that recoding from an
English description would not infringe on a copyright.
Jerry
--
http://www.hoboes.com/jerry/
"Give a man a fish and you feed him for a day. Teach him to fish, and you've
depleted the lake."--It Isn't Murder If They're Yankees
(http://www.hoboes.com/jerry/Murder/)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Thu, 08 Feb 2001 08:17:05 -0800, Jerry wrote:
>In article <slr### [at] fwicom>, ron### [at] povrayorg
>wrote:
>
>>On Thu, 8 Feb 2001 00:36:36 +0100, Alessandro Coppo wrote:
>>>*) Mersenne Twister, currently the best known
>>>http://www.math.keio.ac.jp/~matumoto/emt.html, period is 2**19937-1 it's
>>>not a typo... about 10**6000!!!
>>
>>We can't use this one at this time as its license is GPL.
>
>I saw the Mersenne Twister described in the latest WebTechniques. It
>looked pretty simple. GPL is a copyright, not a patent, as far as I
>know. Though I am not a lawyer, I'm pretty sure that recoding from an
>English description would not infringe on a copyright.
True. It would only be infringement to use the posted code.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ron Parker wrote:
<snippage>
>find a better PRNG for 3.5, since we've all seen some of the bad results
>you can get from the current one.
I am curious: "bad results?" Is the povray generator *that*
bad? I mean, I have not done a rigorous statistical analysis of the
random output but it seems as good (as bad?) as any other random
number generator that I've used. Whenever I get bad results, I use
a different seed.
On thing I *have* noticed about the the random numbers that
pov kicks out is that they *seem* to be more like a stream of pink
"1/f" noise rather than the expected "white" noise: consecutive
values do not differ as much as one would expect (it's as if a "real"
random stream had been run through a mild low pass filter). I have
read that for more "artistic" uses, this "1/f" noise yeilds more
"pleasing" or "natural" results.
Or I could just be full of it. :-)
I suppose one could write a random number generator in the
pov langauge (Arc 4 would work nicely), or another way would be
to just use four random streams, one stream picks which of the other
three streams' output to use. You would be randomly switching
between 3 random streams. Have not tried this.
Pete
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 7 Feb 2001 21:49:22 -0500, Pete wrote:
>Ron Parker wrote:
>
> <snippage>
>>find a better PRNG for 3.5, since we've all seen some of the bad results
>>you can get from the current one.
>
> I am curious: "bad results?" Is the povray generator *that*
>bad? I mean, I have not done a rigorous statistical analysis of the
>random output but it seems as good (as bad?) as any other random
>number generator that I've used. Whenever I get bad results, I use
>a different seed.
There's a high correlation between results, and it can lead to very
recognizable patterns. I can find a reference to the original
discussion here, if you're interested.
> On thing I *have* noticed about the the random numbers that
>pov kicks out is that they *seem* to be more like a stream of pink
>"1/f" noise rather than the expected "white" noise: consecutive
>values do not differ as much as one would expect (it's as if a "real"
>random stream had been run through a mild low pass filter). I have
>read that for more "artistic" uses, this "1/f" noise yeilds more
>"pleasing" or "natural" results.
Nope, the generator is the one I posted. Nothing fractal about it. It's
just not a very good generator. The numbers (or at least the 12345) look
just a little arbitrary.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Jerry <jer### [at] acusdedu> wrote:
: I saw the Mersenne Twister described in the latest WebTechniques. It
: looked pretty simple. GPL is a copyright, not a patent, as far as I
: know. Though I am not a lawyer, I'm pretty sure that recoding from an
: English description would not infringe on a copyright.
It think that the problem with GPL is not that you can't use the source
code (all the contrary, GPL requires that the source code is available
and usable). The problem is that if you use the source code, the new code
you make must be GPL as well.
LGPL would be different.
--
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 2001-02-09 04:09, Ron Parker <ron### [at] povrayorg> wrote:
>On 7 Feb 2001 21:49:22 -0500, Pete wrote:
>Nope, the generator is the one I posted. Nothing fractal about it. It's
>just not a very good generator. The numbers (or at least the 12345)
>look just a little arbitrary.
The example in the C standard also uses 12345 as the offset, but a
different multiplicator. Basically, for this kind of RNG, the three
numbers (the multiplicator, the offset and the modulus), must have a
GCD of 1[1], which is true for 1812433253 = 1289 * 1406077, 12345 = 3 *
5 * 823 and 4294967296 = 2 ^ 32). Then the sequence will produce all
non-negative numbers less than the modulus. Of course, some sequences
look more random than others ...
One problem with this type of RNG is than it produces "subsequences"
for each divisor of the modulus. For a modulus which is a power of two
this is particularly annoying since the lowest bit will run through a
sequence of two, the lowest two bits through a sequence of four etc.
Thus, to get random results, you should always take the highest bits,
not the lowest. Unlike C, Povray makes this "natural", by converting the
value to a double of range [0...1).
hp
[1] My memory is a bit fuzzy here - correct me, if I'm wrong.
--
_ | Peter J. Holzer | All Linux applications run on Solaris,
|_|_) | Sysadmin WSR | which is our implementation of Linux.
| | | hjp### [at] wsracat |
__/ | http://www.hjp.at/ | -- Scott McNealy, Dec. 2000
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|