1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
Public Function GenerateMAC() As String
Dim table As String = "0123456789ABCDEF"
Dim RanMac As New System.Text.StringBuilder
Dim rnd As New System.Random
For i As Integer = 0 To 11
RanMac.Append(table.Substring(rnd.Next(0, table.Length), 1))
Next
Return RanMac.ToString
End Function
Public Function GenerateHEX(ByVal Count As Integer, Optional ByVal Seperator As String = "") As String
If Count < 1 Then Return ""
Dim table As String = "0123456789ABCDEF"
Dim RanHEX As New System.Text.StringBuilder
Dim rnd As New System.Random
For i As Integer = 1 To Count
RanHEX.Append(table.Substring(rnd.Next(0, table.Length), 1))
RanHEX.Append(table.Substring(rnd.Next(0, table.Length), 1))
If i <> Count Then
RanHEX.Append(Seperator)
End If
Next
Return RanHEX.ToString
End Function
|