|
|
|
|
|
<?php
function randomint($max = 100) {
static $startseed = 0;
if (!$startseed) {
$startseed = (double)microtime()*getrandmax();
srand($startseed);
}
return (rand()%$max);
}
$bar = 200;
$foo = randomint($bar);
echo "$foo is a random number between 0 and $bar.";
?> |
|
| Easy to use random number function that seeds with uniqid and allows a max value Categories : Math., PHP | | | decoct -- Decimal to octal Categories : PHP, PHP Functions, Math. | | | Temperature Conversion Categories : PHP, Math., Beginner Guides | | | Show the steps for converting a number from a given base to base 10. Shows the steps involved in converting a number from a given base to base 10. Categories : PHP, Math., Algorithms | | | Calculator for Baroque Violin strings Categories : Math., PHP, Strings | | | How to judge if an integer is odd or is even in Php3? Categories : Math., PHP, Algorithms | | | Arbitrary Precision Math using BCMATH routines Categories : PHP, Math., BC math | | | Greatest Common Denominator - A simple class that finds the greatest common denominator for two integers.
Categories : PHP, PHP Classes, Math. | | | grab the result of any calculation you submit to the Google Calculator. Categories : PHP, Arrays, Web Services, Regexps, Math. | | | 3dLib - a class for drawing in 3D space. Supported functions: Line, SetPixel, Polygon, FilledPolygon, etc. 3dChart() function has been added for one-call drawing of 3d charts. Support of mostly used 3d-transformations. Categories : Graphics, Math., PHP Classes, PHP, Charts and Graphs | | | Library of math functions to expand the functionality of PHP3. Version 1.2.1 fixes a major problem with the gcd function.
Categories : Algorithms, PHP, Math. | | | Prime number finder (Sieve of Erastothenes) Categories : PHP, Algorithms, Math. | | | Math operations on big numbers Categories : PHP, Math. | | | Latitude-Longitude to Miles Categories : PHP, Utilities, Math. | | | Diffusion-Limited Aggregation visualization Categories : PHP, Graphics, Algorithms, Math. | |
| |
| |
|