|
![](/i/fill.gif) |
In article <3D93329F.A5E1E5C4@gmx.de>,
Christoph Hormann <chr### [at] gmx de> wrote:
> Hmm, i'm not sure. If it is possible that two consecutive occur in a
> sequence of random numbers what is the probability of this event?
Ideally, just as likely as any other single combination. That is, not
very likely with this large of a large set of possible combinations.
Say you have 2 (identical) dice. Is the 1:1 combination less likely than
the 1:4 combination?
> In fact i don't even know if mathematics deal with something like non
> integer random numbers.
It does, it doesn't matter if it is integer or not, as long as it is a
set of specific values. There is a finite number of values that can be
represented with a double precision variable, with a perfect random
number generator any one of those values would be equally likely,
whether or not it had just come up the previous time. Assuming the
values are evenly spaced, that is...I think. It depends on how you look
at it and what exactly you want, I guess.
Ok, IANAM (I Am Not A Mathematician), and have never taken a statistics
or set theory course, but:
Picking a random value from a finite set, each value has an equal chance
of coming up, even if it was the previous value.
A perfect random number generator would produce a flat distribution, any
range of resulting values would on average be hit the same number of
times as any other range of equal length. You will get the same number
of values in the range [0, 0.1] as in [0.5, 0.6] and [0.9, 1]. (on
average of course)
I do not think all possible values a double can hold in the [0, 1] range
are evenly distributed...it is probably close enough though. If the
distribution is off, say there are twice as many values in the lower
half of the range then in the upper half, a specific value in the lower
half will have to be less likely than a specific value in the upper half
if you want to keep a flat distribution. However, POV creates a
pseudo-random integer value and scales it down to the right range, so
they are evenly spaced as well as a double value can approximate and the
generator can generate.
BTW, the algorithm POV uses to compute the next random number is:
next_rand[stream] = next_rand[stream] * 1812433253L + 12345L;
return((DBL)(next_rand[stream] & 0xFFFFFFFFUL) / 0xFFFFFFFFUL);
The seed() function sets the initial value of next_rand and returns the
stream index.
--
Christopher James Huff <cja### [at] earthlink net>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tag povray org
http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |