<?php
/**
* Test uniqueness & randomness
*/
require('./libraries/class.Unique.php');
$check_total_each = 1000; // Number of strings to test.
?><html>
<head>
<title>Test uniqueness & randomness</title>
<style type="text/css">
body { font-family: Tahoma, Geneva, sans-serif; margin: 50px; line-height: 3em; }
pre { background-color: #FFC; border: 1px solid #CCC; line-height: 2em; padding: 2em; }
h2 { margin-top: 2em; }
</style>
</head>
<body>
<h1>Test uniqueness & randomness</h1>
<?php
/*
* Numbers = TRUE;
* Alphabets = TRUE;
* Lowercase Alphabets = TRUE;
* Uppercase Alphabets = TRUE;
*/
$unique = new Unique();
$mix_ids = array();
for ($i = 0; $i < $check_total_each; $i++) {
$mix_ids[] = $unique->get();
}
echo '<h2>Alpha (Both) + Numeric</h2>
<pre>
Total : ', count($mix_ids), '
Unique : ', count(array_unique($mix_ids)), '
Sample : ', $unique->get(), '
</pre>';
unset($unique);
/*
* Numbers = FALSE;
* Alphabets = TRUE;
* Lowercase Alphabets = TRUE;
* Uppercase Alphabets = TRUE;
*/
$unique = new Unique(FALSE);
$mix_ids = array();
for ($i = 0; $i < $check_total_each; $i++) {
$mix_ids[] = $unique->get();
}
echo '<h2>Alpha (Both)</h2>
<pre>
Total : ', count($mix_ids), '
Unique : ', count(array_unique($mix_ids)), '
Sample : ', $unique->get(), '
</pre>';
unset($unique);
/*
* Numbers = FALSE;
* Alphabets = TRUE;
* Lowercase Alphabets = FALSE;
* Uppercase Alphabets = TRUE;
*/
$unique = new Unique(FALSE, TRUE, FALSE);
$mix_ids = array();
for ($i = 0; $i < $check_total_each; $i++) {
$mix_ids[] = $unique->get();
}
echo '<h2>Alpha (Uppercase)</h2>
<pre>
Total : ', count($mix_ids), '
Unique : ', count(array_unique($mix_ids)), '
Sample : ', $unique->get(), '
</pre>';
unset($unique);
/*
* Numbers = FALSE;
* Alphabets = TRUE;
* Lowercase Alphabets = TRUE;
* Uppercase Alphabets = FALSE;
*/
$unique = new Unique(FALSE, TRUE, TRUE, FALSE);
$mix_ids = array();
for ($i = 0; $i < $check_total_each; $i++) {
$mix_ids[] = $unique->get();
}
echo '<h2>Alpha (Lowercase)</h2>
<pre>
Total : ', count($mix_ids), '
Unique : ', count(array_unique($mix_ids)), '
Sample : ', $unique->get(), '
</pre>';
unset($unique);
/*
* Numbers = TRUE;
* Alphabets = FALSE;
* Lowercase Alphabets = FALSE;
* Uppercase Alphabets = FALSE;
*/
$unique = new Unique(TRUE, FALSE);
$mix_ids = array();
for ($i = 0; $i < $check_total_each; $i++) {
$mix_ids[] = $unique->get();
}
echo '<h2>Numeric</h2>
<pre>
Total : ', count($mix_ids), '
Unique : ', count(array_unique($mix_ids)), '
Sample : ', $unique->get(), '
</pre>';
unset($unique);
/*
* Numbers = TRUE;
* Alphabets = TRUE;
* Lowercase Alphabets = TRUE;
* Uppercase Alphabets = FALSE;
*/
$unique = new Unique(TRUE, TRUE, TRUE, FALSE);
$mix_ids = array();
for ($i = 0; $i < $check_total_each; $i++) {
$mix_ids[] = $unique->get();
}
echo '<h2>Alpha (Lowercase) + Numeric</h2>
<pre>
Total : ', count($mix_ids), '
Unique : ', count(array_unique($mix_ids)), '
Sample : ', $unique->get(), '
</pre>';
unset($unique);
/*
* Numbers = TRUE;
* Alphabets = TRUE;
* Lowercase Alphabets = FALSE;
* Uppercase Alphabets = TRUE;
*/
$unique = new Unique(TRUE, TRUE, FALSE);
$mix_ids = array();
for ($i = 0; $i < $check_total_each; $i++) {
$mix_ids[] = $unique->get();
}
echo '<h2>Alpha (Uppercase) + Numeric</h2>
<pre>
Total : ', count($mix_ids), '
Unique : ', count(array_unique($mix_ids)), '
Sample : ', $unique->get(), '
</pre>';
?>
</body>
</html>
|