[algogeeks] Re: On random no. generation

2010-09-11 Thread sourav
Thanks sharad for the info. I got it at http://groups.google.co.in/group/algogeeks/browse_thread/thread/31d9864045742a08/fb3e2af1e11087de?hl=en&lnk=gst&q=random#fb3e2af1e11087de Sourav On Sep 12, 7:14 am, sharad kumar wrote: > we have discussed this problem before pls check the archives > > > >

[algogeeks] Re: On random no. generation

2010-09-11 Thread Gene
One of many ways int rand07() { int r; do { r = rand04() + 5 * rand04(); // 0 to 24. } while (r >= 8 * 3); return r / 3; } On Sep 11, 10:07 pm, sourav wrote: > You are given a random no. generator function rand04() that generates > random numbers between 0 and 4 (i.e., 0,1,2,3,4) wit