Remove the while boucle and add more comments on the function

Rewrite of the Random class for avoiding the while boucle.
In both writing the return value is always strictly less than max