Random Number by Hour, Day, Month

From CodeCodex

function seed_random ($how = 'total')
{
	switch ($how)
	{
		
		case hour: // Sets A Random Number For The Hour

			$time = time();
			$today = mktime(0, 0, (int)date("H", $time), (int)date("n", $time),(int)date("j", $time), (int)date("Y", $time));     
			// N.B. pi makes the script more random so as not to repeat numbers from time to time
			srand($today / pi());
			break;

		case day: // Sets A Random Number For The Day
	
			$time = time();
			$today = mktime(0, 0, 0, (int)date("n", $time),(int)date("j", $time), (int)date("Y", $time));     
			srand($today / pi());
			break;

		case month: // Sets A Random Number For The Month
	
			$time = time();
			$today = mktime(0, 0, 0, 0,(int)date("j", $time), (int)date("Y", $time));     
			srand($today / pi());
			break;
		
		default: // Sets a Truly Random Number Based On The Milisecond
	
			srand((double)microtime()*1000000);
			break;

	} // Close The Switch Control
} // Close The Function

// Actual Call To Random Remains The Same In All Cases
$some_var = rand (int min, int max);