|
|
|
|
|
by ted_dunning
305 days ago
|
|
An easy way to make this more efficient is to proceed as normal, but if the point is outside the sphere, run the algorithm again using cyclic xor's of the coordinates. This gives you a free second try without generating new random deviates. You can't do the XOR in floating point representation, but you can if you do the entire algorithm in fixed point or if you retain the random bits before converting to a floating point value. This decreases the number of random numbers that need to be generated from ~5.72 to ~3.88. |
|