RAND() func returns value between 1 to INTMAX, as we know. But when smone tries to find out value between 1 to N he takes remainder of o/p of RAND() with N and adds one......but isn't it wrong coz RAND() will generate numbers with equal probability between 1 and INTMAX but taking remainder can alter the prob. of generating numbers..... e.g.
INTMAX=50 N=30 RAND(50) gives numbers 1 to 30, then prob. will remain same but if it gives numbers 31 to 50, they'll be mapped to the numbers 1 to 20, which means probability of getting numbers 1 to 20 is more than the probability for 21 to 30. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.