|
|
"Nekar Xenos" <nek### [at] gmailcom> wrote:
> I have 5 different mesh bricks, randomly mirrored and rotated, but
> I still get 3 of the same bricks in a row. Any ideas on how to get it more
> random?
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 )".
> Suggestions, help and critique welcome.
>
> -Nekar Xenos-
Cheers,
Edouard.
Post a reply to this message
|
|