```c#
Random random = new Random();
return string.Format("{0}{1}:{2}{3}:{4}{5}:{6}{7}:{8}{9}:{10}{11}", new object[]
{
random.Next(0, 16).ToString("x"),
"6",
random.Next(0, 16).ToString("x"),
random.Next(0, 16).ToString("x"),
random.Next(0, 16).ToString("x"),
random.Next(0, 16).ToString("x"),
random.Next(0, 16).ToString("x"),
random.Next(0, 16).ToString("x"),
random.Next(0, 16).ToString("x"),
random.Next(0, 16).ToString("x"),
random.Next(0, 16).ToString("x"),
random.Next(0, 16).ToString("x")
}).ToLower();
```
```
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
rand.Seed(time.Now().Unix())
a := make([]byte, 6)
rand.Read(a)
fmt.Printf("%02x:%02x:%02x:%02x:%02x:%02x", a[0], a[1], a[2], a[3], a[4], a[5])
}
```
#5
更多评论
<a href="/user/hshd123" title="@hshd123">@hshd123</a> 是生成一组随机数字 mac,转换16进制
#2