okay thanks On Sep 20, 2:59 am, Gene <gene.ress...@gmail.com> wrote: > On Sep 18, 5:45 pm, eSKay <catchyouraak...@gmail.com> wrote: > > > > > okay now I get it. > > > but then > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > int i; > > do > > { > > i = 5 * (rand5() - 1) + rand5(); // i is now uniformly random > > between 1 and 25 > > > } while(i > 7); > > > return i; > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > should be fine. isn't it?? > > Sure. It just wastes more random numbers than it needs to, which > slows it down.
--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---