<?PHP
$max = 100;
$temp = explode(‘ ‘,’A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9’);
$data = array();
$n = 0;
while ( $n<$max )
{
shuffle($temp);
$code = implode(”,array_slice($temp,0,4)).’-‘.implode(”,array_slice($temp,4,4)).’-‘.implode(”,array_slice($temp,8,4)).’-‘.implode(”,array_slice($temp,12,4));
if ( isset($data[$code]) ) continue;
$data[$code] = true;
$n++;
echo $code.”<br>”;
}
$keys = array_keys($data); unset($data);
?>
4자리 숫자+문자 네번조합의 결과물을 보여줍니다.
예) BKS0-VY85-Q4LF-6C1Z 등
더하기..엑셀 매크로 이용한 난수발생코드
Sub macro()
Dim a As New Collection
On Error Resume Next
Do
test.Text = “ADAD”
txt = Chr(Int(0) + 65) & Format(Int(Rnd * 10000), “0000”) & Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65) & Chr(Int(Rnd * 26) + 65) & Format(Int(Rnd * 10000), “0000”)
a.Add txt, txt
Loop Until a.Count = 50
For i = 1 To a.Count
Cells(i, 1) = a(i)
Next
End Sub