Re: rand() pattern in texture?

From: Phil Carmody (thefatphil_demunged_at_yahoo.co.uk)
Date: 10/14/04


Date: 14 Oct 2004 12:15:18 +0300

Carlos Moreno <moreno_at_mochima_dot_com@xx.xxx> writes:
> > Using modulo is bad only for generators like the LCG, where the low order
> > bits have a short period.
>
> Nope. Using modulo is bad even for a *true* random number
> generator.
>
> Imagine you have a *perfect*, *true* RNG (e.g., based on
> quantum-level particle measurements) that produces a uniformly
> distributed number between 0 and 9. Suppose that what you
> want is a uniformly distributed number between 0 and 3.

You need to think about this a bit more.

10 into 4 doesn't go, no matter _how_ you do it.
(Unless you are prepared to throw away samples).

> It's not a matter of avoiding the LS bits, it's a matter of
> using *all of the bits*, combined in a way that hopefully will
> take as much entropy from the whole 32-bits (or whatever amount
> of bits the LCG gives us) and convey it to our randomly-generated
> value.

It doesn't matter which bits you take in a LCG you always get
all the available entropy.

Phil

-- 
They no longer do my traditional winks tournament lunch - liver and bacon. 
It's just what you need during a winks tournament lunchtime to replace lost 
... liver.   -- Anthony Horton, 2004/08/27 at the Cambridge 'Long Vac.' 


Relevant Pages

  • Re: Software roulette statistics
    ... Software gambling routines depend on random number generators. ... all multipliers of linear confuences being "defective" in two dimensions. ... period of the LCG is AT MOST M, ... better and faster than most other LCGs but suffer the same DEFECTS ...
    (sci.stat.math)
  • Re: Software roulette statistics
    ... The property of "mainly on the plain" or hyperplanes is common the ... ALL linear congruential generators! ... period of the LCG is AT MOST M, ...
    (sci.stat.math)