|
General Details
|
|
PHP (Hypertext Preprocess...
|
|
Posted 110 Days Ago
|
|
442 Views
|
|
Received 0 Ratings
|
|
Pool of Random Numbers (Class)
Description
Creates a pool of numbers that you can add individually, or by setting a range. Then each time you call the get_number() method a random number will be selected from the pool and returned for you to use in your code or to print to the browser. Once a number has been taken from the pool using get_number() it will be removed from the pool to prevent it being used again.
Technical
Using PHP 4, and is compatible with PHP 5.
add_range($min, $max)
Setting $min as 1 and $max as 10 would result in the following numbers being available in the pool: 1,2,3,4,5,6,7,8,9,10
add_number($number)
Will allow you to add one number at a time.
Since i have not added numeric datatype checking to the add_number method, you can add strings to the pool and they will be selected in the same was as if they were numbers!
Source Code
Comments
| Please login to post comments. |
More "PHP (Hypertext Preprocessor)" Source Codes By This Author
Recently Posted "PHP (Hypertext Preprocessor)" Source Codes
Recently Rated "PHP (Hypertext Preprocessor)" Source Codes
|