SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member moneybyus's Avatar
    Join Date
    Mar 2001
    Location
    MN
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    probabilty question

    I am making a instant win game at my site and I need to find out how I can set the probability of a win occuring. I want the odds of winning to be something like 1 in 25000 but have it occur randomly sometime within that 25000. Not just make it occur on the 25000th time the script is run.

    Does anyone understand what Im asking, I know its probally confusing.

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Uhhhmm...just generate a random number between 1 and 25,000 and then store it in a database? Check out mt_rand() at:

    www.php.net

    I think the maximum number it will generate is higher than 25,000. Also, don't forget to seed mt_rand() with mt_srand() before you generate the random number.
    Last edited by 7stud; Jun 10, 2001 at 23:45.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •