Just noticed that you asked for 1-10, and my code will clearly generate
0-9. Add one for the desired range.
Don
On Wednesday, February 5, 2014 4:29:26 PM UTC-5, Don wrote:
>
> // Using George Marsaglia's Multiply With Carry generator
> int rnd10()
> {
> static unsigned int x = time(0);
> x = 63663 * (x&65535) + (x>>16);
> return (x & 65535) % 10;
> }
>
> On Sunday, February 2, 2014 2:51:47 AM UTC-5, atul007 wrote:
>>
>> Generate random number form 1 - 10 with probability of 1/10.You are not
>> allowed to used rand() function.
>>
>> any simple way of achieving above with using any complex implementation
>> of random number generators algorithm .
>>
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].