On Fri, November 3, 2006 10:52 am, Matthew Walker wrote:
> This will generate a random input file for you:
>
> <?php
>
> $lines = mt_rand(10,100);
>
> for ($i = 0; $i < $lines; $i++) {
> $entries = mt_rand(10,100);
> for ($j = 0; $j < $entries; $j++) {
> if ($j > 0) {
> echo " ";
> }
> echo mt_rand(-100, 100);
> }
> echo "\n";
> }
>
> ?>
>
> Run that and pipe the output to a file. Enjoy. :)
>
Just a note about this code....
It'll generate lots of non-matching lists. If you want to increase the
match probability, reduce the range on the inner-most mt_rand(). Maybe
like this:
<?php
$lines = mt_rand(10,100);
for ($i = 0; $i < $lines; $i++) {
$entries = mt_rand(10,100);
for ($j = 0; $j < $entries; $j++) {
if ($j > 0) {
echo " ";
}
echo mt_rand(-1 * $entries, $entries);
}
echo "\n";
}
?>
--
Matthew Walker
Kydance Hosting & Consulting
LAMP Specialist
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/