Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
Name Of Argument
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Kai-Uwe Bux, post: 2520873"] Do you really want to reseed by time the RNG every time you deal a card? Usually, this will result in way less random looking behaviour. do you have defined operator<< for the type Hand? a) this for() loop does not make random_int any more random. b) this way of generating random integers in [lowest, highest] does not quite exactly produce a uniform distribution (unless range happens to divide RAND_MAX. c) Are you certain that RAND_MAX+1 will not cause an arithmetic overflow? This approach is expensive. You might consider the following: Before dealing the hands, shuffle the deck: std::random_shuffle( cards_in_deck.begin(), cards_in_deck.end() ); Then, within the card dealing function, just deal the card cards_in_deck.back(); and then get rid of it by cards_in_deck.pop_back(); Best Kai-Uwe Bux [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
Name Of Argument
Top