sign in


Forgot your password?


Why sign up?
- One account for five websites!
- Free access to Premium Codes
- Acess to cool web tools
- Ask and answer questions
- Stay ahead of other web developers
- and MUCH MORE!

Feel The Power

Php Code: Check Percentage Chance

This script returns a 1 (true) or 0 (false) based on the percent parameter. I use this function in any games I create to determine randomness of specific actions that would require a precise percentage.This function returns a 1 or 0.
This function works with any decimal number between 0 - 100. All negatives return 0. All numbers greater than 100 return 1. A common use could be to determine a critical chance. Code is well commented. Copy and paste in an editor and run in a browser to see how it works. Took me a few days to get it running, and I tested the life out of it. Works to the nearest hundred on numbers between 0 and 100. You can tweak it to work the nearest tenth or thousandth if you like. Enjoy!

If you don't know how to use this code or need more information Click here!

Online Users: 3
Total Online Users: 46
Recent Members: yuri , Ahmadullo, Ruqyahstor, Steven12345, dragoncitya
Twitter LinkedIn Youtube

Link to us:


Please put this code in your page.