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 Programming
rand in a closed interval on the ints
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="Frank Silvermann, post: 2468615"] That's where I'm headed with this, but I need to stay in the shallows for a little longer. I had forgotten that C was going to give me modulo without trying so hard. This looks right on the nuts to me. I could, for this function's sake, now sack the SWAP macro. You probably skimmed right past it, but given that I'm going to need it elsewhere, I might as well use it. Your roll_again_threshold versus my top is a subtle comparison. At first they appear different but your while condition allows one more or less than mine. roll_again_threshold must be right (modulo num_results) else cases will not be equiprobable. At this point, I believe we are both within two of the correct value. gruss, frank [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
rand in a closed interval on the ints
Top