sign in

 



Forgot your password?

signup

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!




You can also sign up by your facebook account!
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.
1=true
0=false
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!





Review

Please Rate this!
VISITORS
Online Users: 45
Total Online Users: 63
Recent Members: neela, tnresults, sambj, bknigth@thefletcherschool.org, salimapon4
FIND US

LINK US

Link to us:

Please put this code in your page.