POV-Ray : Newsgroups : povray.binaries.images : Toward a less-lame rand() function. : Re: Toward a less-lame rand() function. Server Time
1 Aug 2024 00:19:03 EDT (-0400)
  Re: Toward a less-lame rand() function.  
From: Kenneth
Date: 20 May 2009 03:00:00
Message: <web.4a13a8d82a89ae6df50167bc0@news.povray.org>
"Slime" <fak### [at] emailaddress> wrote:
> ...When you
> always start with a similar number, this basic math doesn't provide enough
> randomness. However, you might find that you can get better results if you
> call rand() with the seed a few extra times before using it.
>

and Darren wrote (taken out of context)...
> The lack of randomness is between the seed and the first value, not
> between the first and second value.  Indeed, it would be interesting to see
> a similar plot if one called rand() exactly once after seeding it.

> ...The formula for
> going from one random number to the next shows convincing randomness. The
> formula for going from the seed to the first random number does not.

So skipping the first (or first few) rand values sounds like a good recipe for
avoiding patterns, especially in animation using seed(frame_number) and pulling
only a few rand()s from the seed. Thanks to you both for the info; VERY
useful.

KW


Post a reply to this message

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