View Single Post
Old 11-15-2002, 01:15 AM  
Dragon Curve
Confirmed User
 
Join Date: Oct 2002
Posts: 252
Quote:
Originally posted by strainer
Ok, here is how Boldy's original idea worked great for me:

// Range of numbers
$min = "1"; // Min number
$max = "10"; // Max number

mt_srand(time()); // mt_srand() is used to seed mt_rand()

$RandomValue = mt_rand( $min, $max);

if ($RandomValue == 10) {
header("HTTP/1.0 200 OK");
//echo ( "fooey" ) ;
}

What this does now is only return the 200 OK 10% of the time. The other 90% of the time the user can hit the back key after they see a nice error page. I think I am going to change this to say, 1 ouf 20 and put in production now. Looks great in test...
Note that that won't give you a 10%. For all you know you could get RandomValue equaling 10 every single time. Unlikely, but possible. Doesn't really matter tho.
Dragon Curve is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote