[Prev] Thread [Next]  |  [Prev] Date [Next]

[algogeeks] Re: Pbm with rand() function Dave Sun Feb 26 15:00:30 2012

@Karthikeya: Integer division truncates. So m is the largest multiple
of N that is less than or equal to RANDMAX. E.g., in your example, m =
(50 / 30) * 30 = 1 * 30 = 30, since 50/30 truncates to 1.


On Feb 26, 12:33 pm, karthikeya s <[EMAIL PROTECTED]> wrote:
> "int m = (RANDMAX / N) * N"
> isn't m= RANDMAX simply....it couldn't understand the what is the
> logic here.....

You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at