Because if you put that in a loop you will get a series like:

3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5...

On Thursday, February 6, 2014 8:27:27 PM UTC-5, SVIX wrote:
>
> Just curious... Why is this more random than 
> (getSystemTimeInMilliseconds() % 10)
>
> On Thursday, February 6, 2014 1:47:15 PM UTC-8, Don wrote:
>>
>> 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 algogeeks+unsubscr...@googlegroups.com.

Reply via email to