![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <3a92f00e@news.povray.org>, "Rune" <run### [at] iname com>
wrote:
> There are many reasons. For example I want my particle system to be
> frame-independent, so that the even the randomness of the particles
> is the same independent on the frame-rate used. I also need it for
> the cyclic animation feature where the whole calculation process is
> basically run through several times, and where the random numbers
> must be the same each time.
If I understand this correctly, you may want to try separating your
render frames from your calculation frames...do a fixed number of
iterations for a specific time period (for example, always compute 500
iterations by the time clock reaches 1), and you will get the same
result. Of course, it won't work very well if you use more frames than
iterations, but you might be able to work out an interpolation method to
save computation time and get reasonably good results.
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Rune <run### [at] iname com> wrote:
> "Lutz-Peter Hooge" wrote:
>> I think an array initialized with random numbers could be
>> used for this. Of course it will need to be very large, or
>> the numbers will repeat much more often than in a normal
>> random numer stream.
> At first I thought the array needed would be too large, but wouldn't it work
> to make a relative small array, and then use averages of different numbers
> from the array?
> If 3 numbers from the array were averaged the amount of different numbers
> would be array_length^3 and if 8 numbers were averaged it would be ^8 !
> Maybe this is the solution?
Those wouldn't be equally distributed though. The mean of three uniformly
distributed numbers is not uniformly distributed.
Geoff
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Wlodzimierz ABX Skiba
Subject: Re: Random number generator needed !
Date: 21 Feb 2001 08:26:16
Message: <3a93c1f8@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Rune wrote in message <3a92cca8@news.povray.org>...
> I need a macro that outputs a random number between 0 and 1 when called. It
> should have two integers as input. The reason I can't just use rand() and
> seed() is that I need it to always output the same random number when the
> same input numbers are used.
>
> I need a macro like this: Rand (Int1, Int2)
>
> I don't know anything about random number generators myself, so some help
> would be much appreciated.
perhaps this will help you:
#macro Rand(I1,I2)
rand(seed(val(concat(str(I1,0,0),str(I2,0,0)))))
#end
ABX
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Wlodzimierz ABX Skiba <abx### [at] abx art pl> wrote:
: rand(seed(val(concat(str(I1,0,0),str(I2,0,0)))))
Isn't this effectively the same as:
rand(seed(I1*I2))
?
(Not identically the same result, but effectively the same idea.)
--
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Wlodzimierz ABX Skiba
Subject: Re: Random number generator needed !
Date: 21 Feb 2001 09:22:03
Message: <3a93cf0b@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Warp wrote in message <3a93cc9d@news.povray.org>...
> Wlodzimierz ABX Skiba <abx### [at] abx art pl> wrote:
> : rand(seed(val(concat(str(I1,0,0),str(I2,0,0)))))
> Isn't this effectively the same as:
> rand(seed(I1*I2))
> (Not identically the same result, but effectively the same idea.)
multiplication has symetry
concatenation hasn't
ABX
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Wlodzimierz ABX Skiba <abx### [at] abx art pl> wrote:
: multiplication has symetry
: concatenation hasn't
Your solution just multiplies I1 with the smallest multiple of 10 that
is larger or equal to I2 and then adds I2 to the result.
This is effectively the same as I1*I2+I2, the only difference being that
instead of multiplying with a the smallest multiple of 10 which is larger
or equal to I2, we are multplying with the smallest number which is larger
or equal to I2, which is, of course, I2 itself.
Now, I1*I2+I2 = (I1+1)*I2, and by all practical means this probably will
not give a too different result than just I1*I2.
That's why I think that I1*I2 will probably give an equally good result
with less overhead.
--
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Wlodzimierz ABX Skiba" wrote:
> perhaps this will help you:
>
> #macro Rand(I1,I2)
> rand(seed(val(concat(str(I1,0,0),str(I2,0,0)))))
> #end
Unfortunately not. It's not at all random...
Basically it will never be of any use to use rand( seed( VAL ) ) no matter
what "VAL" is, because it won't add any randomness at all.
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated January 28)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Geoff Wedig" wrote:
> Rune <run### [at] iname com> wrote:
>
> > "Lutz-Peter Hooge" wrote:
> >> I think an array initialized with random numbers could be
> >> used for this. Of course it will need to be very large, or
> >> the numbers will repeat much more often than in a normal
> >> random numer stream.
>
> > At first I thought the array needed would be too large, but wouldn't it
work
> > to make a relative small array, and then use averages of different
numbers
> > from the array?
>
> > If 3 numbers from the array were averaged the amount of different
numbers
> > would be array_length^3 and if 8 numbers were averaged it would be ^8 !
>
> > Maybe this is the solution?
>
> Those wouldn't be equally distributed though. The mean of three uniformly
> distributed numbers is not uniformly distributed.
>
> Geoff
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Geoff Wedig" wrote:
> > wouldn't it work to make a relative small array, and then
> > use averages of different numbers from the array?
>
> Those wouldn't be equally distributed though. The mean of
> three uniformly distributed numbers is not uniformly
> distributed.
Yes, I realised that...
Maybe instead of averaging I can just add together and then use mod() on the
result. It may cause a kind of repeats in the pattern, but it should be
possible to reduce it to a minimum.
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated January 28)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Chris Huff" wrote:
> If I understand this correctly, you may want to try separating
> your render frames from your calculation frames...
I did that a long time ago; that's not the problem.
> do a fixed number of iterations for a specific time period
> (for example, always compute 500 iterations by the time clock
> reaches 1),
Yes.
> and you will get the same result.
Yes, if the random steams are reliant on the calculation frames only and not
the render frames. And my problem is to achieve that.
I tried to use a new random stream for every calculation frame, but that
didn't work, as the Nth random number from the streams M, M+1, M+2, ...
would just change linearly. In other words, random numbers from one stream
are random compared to each other, but different streams are *not* random
compared to each other. (I think it's a common misunderstanding to think
that they are.)
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated January 28)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |