Jump to content

Random Number


adam84

Recommended Posts

I need 'x' amount of random numbers, when i use the code below I always get the same results. Is there a better or different way of doing it?

 

	for( $i = 0; $i 5; $i++){
		$time = time();
		$length = 10;
		srand(date("s")); 
		$possible_charactors = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
		$ticketNum = ''; 
		while(strlen($ticketNum )<$length)
		$ticketNum .= substr($possible_charactors, rand()%(strlen($possible_charactors)),1);
	echo 	$ticketNum. "<BR>";

	}

Link to comment
https://forums.phpfreaks.com/topic/43149-random-number/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.