Author: david
Date: Mon Dec 6 16:38:27 2010
New Revision: 8875
Log:
Force mt_rand() range to 2^31.
Modified:
trunk/lib/model/QubitSlug.php
Modified: trunk/lib/model/QubitSlug.php
==============================================================================
--- trunk/lib/model/QubitSlug.php Mon Dec 6 16:20:52 2010 (r8874)
+++ trunk/lib/model/QubitSlug.php Mon Dec 6 16:38:27 2010 (r8875)
@@ -28,9 +28,11 @@
// Probability of generating a collision can be found using this formula
//
http://en.wikipedia.org/wiki/Birthday_paradox#Cast_as_a_collision_problem
//
- // For getrandmax() = 2^31-1 (32-bit signed integer max) probability of
- // collision is >50% when we reach approx. 50,000 records
- $rand = rand();
+ // Force max random value of 2^31-1 (32-bit signed integer max).
+ //
+ // With 2^31 possible values, the probability of collision is >50% when we
+ // reach approx. 50,000 records
+ $rand = mt_rand(0, pow(2, 31)-1);
// Convert $rand to base36 hash
while (36 < $rand)
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.