Years ago I wrote a Yahtzee program which used feedback from user
mouse movements to add entropy to the random generator. Using Borland
Builder (Visual Studio could do the same thing) I created an event
"OnMouseMove" which is called any time the mouse moves from one pixel
to another. It provides the X and Y coordinates for the mouse
location. I had a pool of 600 dice with 100 of each value (1-6), and
when a mouse move event occurred, it used the X and Y locations to
pick two dice in the pool and swap them. The user had to move the
mouse around to select which dice to keep, to click on the "Roll"
button, etc, so there was lots of input to the OnMouseMove event. It
also used a timer which caused an event every 1/1000th of a second,
which used a multiply-with-carry generator to select one dice in the
pool to swap with another dice. That made sure that all the dice moved
around frequently. Then when the user rolled the dice, it picked
random locations in the pool and used the value at that location. The
result was a truly random, non-deterministic dice roll which would be
affected by the slightest difference in the way you moved the mouse in
the window, which is something I doubt that most commercially produced
Yahtzee programs can claim.

Similar things could be done for card games to shuffle the deck. You
could have the deck for the next game shuffling while the current game
is being played.

Don

On Jul 31, 4:39 am, Puneet Gautam <puneet.nsi...@gmail.com> wrote:
> Can we write a code to generate random numbers without using rand function..?
>
> Pls help me on this!!

-- 
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.

Reply via email to