note 63428 deleted from function.srand by bjori
| From: | bjori@php.net | Date: | Wed, 22 Mar 2006 12:27:43 +0000 |
| Subject: | note 63428 deleted from function.srand by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-106236@lists.php.net to get a copy of this message | ||
Note Submitter:
Reason: useless
----
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>$uperRandomNumber v0.0.1</title>
<style type="text/css" media="screen">
body
{margin-left:30px
;margin-top:100px
}
.title
{font-family:"Courier New"
;font-size:200%
;font-weight:bold
}
.random
{font-family:"Courier New"
;font-size:11pt
}
</style>
</head>
<body>
<span class="title"><u>Su</u>p<u>erRandomNumber</u>
v0.0.1</span><span class="random">
<?php
function SuperRandNumber ( $tringLength, $NullStart )
{
/*************************************************
**************************************************
**** ****
**** 1) $trinLength ****
**** Represents the length you want ****
**** from the call of the function. ****
**** 2) $NullStart ****
**** Represents whether you like to have ****
**** a Null ("0") at first sign you have ****
**** to check TRUE or similar to Null (0). ****
**** FALSE or similar to Null (0) will ****
**** replace first sign to unequal Null. ****
**** ****
**************************************************
*************************************************/
list($igns,$i)=explode('.',(string)$tringLength);
$uperRandomNumber='';
$RandomMin=10;
$RandomMax=12345;
@srand((double)microtime()*(12345+67890));
for($i=0;$i<$igns;$i++)
{$LongNumber=@rand($RandomMin,$RandomMax);
$PartOf =@rand(0,strlen($LongNumber));
$LongNumber=(string)$LongNumber;
$uperRandomNumber.=$LongNumber{$PartOf};
}// for
if($NullStart===FALSE||$NullStart===0)
{$i=@rand(1,9);
$uperRandomNumber=$i.substr($uperRandomNumber,1);
}// if
return $uperRandomNumber;
}// function
echo("\n<br />\n");
$k=1000000;// 1 Mio.
for($i=0;$i<$k;$i++)
{echo SuperRandNumber($i,1);
echo("\n<br />\n");
}// for
?>
</span>
</body>
</html>