# calculating probability::options?

• 11-19-2002
Waldo2k2
calculating probability::options?
i've been calculating probability for a program of mine
i've been using srand, rand()%2 for say a 50-50
i'd use a if to see if it was between 0 and 1 for one outcome and greater than 1 for the other. It works, but, is there a more accurate or better way to do this?
• 11-19-2002
skipper
Lord, have you opened the proverbial "Can of Worms"!?!

Research this one. There are more responses, opinions, thoughts and ideas than you can imagine! (Makes you wish for simpler, happier times! :) )

-Skipper
• 11-19-2002
Waldo2k2
well there's none on this site...know of any sites off hand?
• 11-19-2002
XSquared
yep. here
• 11-19-2002
Waldo2k2
>>here
very funny, i could've done that myself, i wanted you all to do everything for me! jeese, people these days....:)
• 11-19-2002
Waldo2k2
wow, for a plethora of worms i didn't find much
maybe i'm searching wrong, but i've found nothing on 3 boards and google game me nothing but crap. Any ideas?
• 11-20-2002
skipper
In all honesty, there may be more of a dearth than a plethora of worms concerning your question here.

I ran rather quickly, truth be told, with the rand() thing - which has been done to death - without engaging my brain to incorporate the remainder of your question. My fault.

After some not too serious looking on my own, I basically came up with squat, too. :(

Sorry Waldo2k2.

-Skipper
• 11-20-2002
Waldo2k2
well i did find a very obscure way of doing this today using the left shift operator on a series of bits...all in all it comes out with either a 1 or a 0 in the value of a variable. It works for me.
• 11-20-2002
skipper
As long as it works... :)

-Skipper