POV-Ray : Newsgroups : povray.advanced-users : Random number generator needed ! : Re: Random number generator needed ! Server Time
30 Jul 2024 02:14:20 EDT (-0400)
  Re: Random number generator needed !  
From: Geoff Wedig
Date: 21 Feb 2001 13:48:01
Message: <3a940d61@news.povray.org>
Rune <run### [at] inamecom> wrote:

> "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.

How big are your numbers?  You could use the nth value off the stream seeded
with m, if you're assured they're not too big (expensive, though)

Another possibility is using some sort of function to hash to a single
value.  a*n1 + b*n2 which you then use as your seed, and get the random
number that way.

Geoff


Post a reply to this message

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