Menu

#2 100% Probability = 0% Probability

open
nobody
5
2007-01-31
2007-01-31
Anonymous
No

The code "if ( rand() < (int)(RAND_MAX * p) ) vs[i+WIDTH] = type;" in the Emit function fails to work properly for p = 1.0f. My guess is that (int)(RAND_MAX * p) is equal to 1 higher than the maximum integer. Changing the code to "if ( rand() < (unsigned int)(RAND_MAX * p) ) vs[i+WIDTH] = type;" fixes this bug. It is possible that some machines might cast int to a larger primitive, preventing this bug from occuring.

Discussion


Log in to post a comment.