✔ 最佳答案
Sub Main()
Dim Serial As String = ""
Dim Num As Integer
Dim RndChr As Char
Randomize() '先亂數化
For i = 1 To 20 '序號共20個字
Do
Num = Rnd() * 90
RndChr = Chr(Num)
Loop While Not ((Num >= 48 And Num <= 57) Or (Num >= 65 And Num <= 90)) '大寫字母或數字
'Serial = Serial + RndChr
If i Mod 4 = 0 Then
Serial = Serial + RndChr
If i < 20 Then
Serial = Serial + "-"
End If
Else
Serial = Serial + RndChr
End If
Next
Console.WriteLine(Serial)
Console.ReadLine()
End Sub