4 ms·
If we are trying to optimize anything, you should probably drop all the unnecessary floating point divisions. I would expect those to be the bottleneck in your
by jacobolus 8y ago
If we are trying to optimize anything, you should probably drop all the unnecessary floating point divisions. I would expect those to be the bottleneck in your code, though you’d probably want to time it to be sure.
(rand()/(double)RAND_MAX) etc.
Instead assign some name to 1.0/(double)RAND_MAX, and multiply.