Jump to content

[SOLVED] Random Percentage


rascle

Recommended Posts

Hi

I am creating an online game and i want there to be an $value which is a percentage so lets say 70% and then i want $random number to generate a number that is likely according to the percentage so if the percentage is 70% then $random would more likely to be yes than no. If $value was 30% then $random would more likely to be no than yes and so on and so forth!

I know that you could probaly do that using arrays but the only way i could think of doing it would take a long time. Also in the code please bear in mind that $value is dependant on whether the player has a certain objects or whatever.

Thanks

Rhys

Link to comment
https://forums.phpfreaks.com/topic/147795-solved-random-percentage/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.