LZ: Random Number making
[Prev][Next][Index][Thread]
LZ: Random Number making
Hey, I'm looking at making a hand dealer, and eventually a playing program
for bridge, cribbage, or hearts, and I'm wondering how I can create random
numbers from 0 to 3 and 0 to 12. I've already looked at random number
routines, but none that I've seen have explained limiting the range of the
number obtained. Also, how would be the best way to represent cards? I
think a 16 bit number would work best:
Suit: Value : Card: Value:
Clubs 00 2 00
Diamonds 01 3 01
Hearts 02 ... ...
Spades 03 Jack 09 And so on.
Combining these, I'd get:
4 of Clubs is $0002
Jack of Hearts is $0209
etc.
Would this work? Thanks for any help!
________________________________________________________________
| Marc Heikens | Fear not all is well. |
| kheikens@owt.com | Fear, not all is well. |
|______________________________| Fear not, all is well. |
| Reduce your stress level! | |
| Buy a Macintosh! | --Truth lies in interpretation.|
|______________________________|_________________________________|
Follow-Ups: