Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@CoffeeSnake rand() can be any integer.
% 100 does modulo division so that the result is in the range 0 to 99.
Then, < 98 makes sure that the result is true for the most time, but sometimes false. -
@Lensflare is there a limit for rand()? If not then I imagine it'd very rarely be true
-
@Lensflare I guess I was thinking of 0 to 100 % 100 < 98 would be kind of redundant. After thinking for a minute I see how this is basically a 100-sided dice roll.
Related Rants
Repost from r/programmerHumor
joke/meme
rand
false
true