Re: rand() pattern in texture?
From: codemagic (codemagic_at_gmail.com)
Date: 10/12/04
- Next message: Angela Milazzo: "Re: Average Length of a line"
- Previous message: Acid Pooh: "Re: Math books online"
- In reply to: The Ghost In The Machine: "Re: rand() pattern in texture?"
- Next in thread: John M. Gamble: "Re: rand() pattern in texture?"
- Reply: John M. Gamble: "Re: rand() pattern in texture?"
- Reply: Carlos Moreno: "Re: rand() pattern in texture?"
- Messages sorted by: [ date ] [ thread ]
Date: 11 Oct 2004 23:02:57 -0700
Thanks you folks for your assistance!
I've experimented a bit more and found out the following:
1. The anomaly is 100% repeatable if I do rand() % c where c is a power
of 2. If c is not a power of 2 then I don't see the anomaly. Note that
the texture size I am using is a power of 2.
2. Shifting the result of rand() before doing the %c also seems to
work, e.g. (rand() >> 10) % 8 is OK. This is perhaps a better technique
because it doesn't restrict c.
Solved! Although I may also try the Mersenne Twister
(http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html) - if so I'll
let you know what I find.
Best Regards,
Tom
- Next message: Angela Milazzo: "Re: Average Length of a line"
- Previous message: Acid Pooh: "Re: Math books online"
- In reply to: The Ghost In The Machine: "Re: rand() pattern in texture?"
- Next in thread: John M. Gamble: "Re: rand() pattern in texture?"
- Reply: John M. Gamble: "Re: rand() pattern in texture?"
- Reply: Carlos Moreno: "Re: rand() pattern in texture?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|