Jump to content

Scratch Tickets


Monkuar

Recommended Posts

I need to use the rand function but how would I go about incorporating into let's say..

 

somone spends some (Forum gold) on my site, (you get these golds from posting)

 

Somone buys a Scratch Ticket and it will give them 1-200 forum Gold (random chance) how would I go about doing that with the rand function?

 

Also, could there be something I add like a % value that it will be less then 200 inside the 1-200 phase? Kinda confusing, but pretty much can I say 50% of users will get less then 50 Forum Gold from the 1-200FG Chance Ticket?

Pretty much adding a % modifier with the rand function so people don't get essentially "Free" forum gold, that there is a 20% of actually getting 100-200 AMOUNT, and 80% of actually getting less then 100?

 

Any idea?

 

i know how to code it with mysql/php I just need somone to lift me up right now and get a little boost of code/help to get me started and a explanation

Link to comment
Share on other sites

So tired I forgot to paste in the code, apparently. :P

 

But anyhow, I had a flaw in it. This would give about a 50/50 shot at the ensuing 50/50 shot of getting 100+ points. Overall should be about a 25% probability of getting 100+.

 

$max = array_rand( array_flip(array(99,200)) );
$rand = mt_rand(1, $max);
echo $rand;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.