Paul Herring wrote: > On Tue, Mar 2, 2010 at 3:44 PM, Jos Timanta Tarigan > <jos_t_tari...@yahoo.com> wrote: >> http://www.devmaster.net/articles/raytracing_series/part5.php > > The answer to your question is actually on that page: > > # The code also uses a new random number generator: The Mersenne > # Twister. This is a random number generator that gives better results > # than the build-in Rand() function, and is a bit faster > # as well. The Mersenne Twister resides in twister.cpp and twister > >>From http://en.wikipedia.org/wiki/Mersenne_twister > > $ For a k-bit word length, the Mersenne Twister generates numbers with > $ a uniform distribution in the range [0,2^k - 1]. > > So, yes, you could replace it with a call to rand(), but it's likely > to be slower. Given one of those images took 11 minutes to produce > (back in 2005) I've no idea how much slower it is.
Well, it probably depends on a compiler's standard library implementation. On one of my older Borland compilers, I'm pretty sure rand() was a single multiplication operation against a static value. -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/