|
|
On Wed, 28 Apr 2010 07:33:29 +0200, Edouard <pov### [at] edouardinfo> wrote:
> Ahh - I came across this problem several times in the past, and I ended
> up
> learning about low-discrepancy sequences - which are completely
> non-random, but
> more "randomly" distributed than a real random sequence.
>
> My code for a halton sequence is:
>
> #macro halton( index, base )
> #local out = 0.0;
> #local fraction = 1.0 / base;
> #local i = index;
> #while( i > 0 )
> #local remainder = mod( i, base );
> #local out = out + (fraction * remainder);
> #local i = int(i / base);
> #local fraction = fraction / base;
> #end
>
> out
> #end
>
> The base value is a prime number (the smaller the better), and the index
> can be
> your brick number.
>
> Get a value out of it with "halton( brick_number, 2 )".
>
> Cheers,
> Edouard.
>
Thanks!
-Nekar Xenos-
Post a reply to this message
|
|