Thread: calculating probability::options?

  1. #1
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001

    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?
    PHP and XML
    Let's talk about SAX

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    362
    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
    "When the only tool you own is a hammer, every problem begins to resemble a nail." Abraham Maslow

  3. #3
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    well there's none on this site...know of any sites off hand?
    PHP and XML
    Let's talk about SAX

  4. #4
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    yep. here
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  5. #5
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    >>here
    very funny, i could've done that myself, i wanted you all to do everything for me! jeese, people these days....
    PHP and XML
    Let's talk about SAX

  6. #6
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    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?
    PHP and XML
    Let's talk about SAX

  7. #7
    Registered User
    Join Date
    Apr 2002
    Posts
    362
    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
    "When the only tool you own is a hammer, every problem begins to resemble a nail." Abraham Maslow

  8. #8
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    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.
    PHP and XML
    Let's talk about SAX

  9. #9
    Registered User
    Join Date
    Apr 2002
    Posts
    362
    As long as it works...

    -Skipper
    "When the only tool you own is a hammer, every problem begins to resemble a nail." Abraham Maslow

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Calculating : high numbers
    By MiraX33 in forum C++ Programming
    Replies: 9
    Last Post: 06-08-2006, 11:08 PM
  2. Calculating CPU Usage
    By vitaliy in forum Linux Programming
    Replies: 3
    Last Post: 08-21-2005, 09:38 AM
  3. Recursion
    By Lionmane in forum C Programming
    Replies: 11
    Last Post: 06-04-2005, 12:00 AM
  4. Taking input while calculating
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 07-12-2002, 04:47 PM
  5. Calculating window sizes
    By Mox in forum Windows Programming
    Replies: 3
    Last Post: 11-08-2001, 09:17 PM