代码很简洁,每个人能看得懂,不多说了。
GO语言:
func main() {
a:=make([]rune,100)
for i:=range a {
a[i]=rune( RandInt(19968,40869))
}
fmt.Println(string( a))
}
func RandInt(min, max int64) int64 {
rand.Seed(time.Now().UnixNano())
return min + rand.Int63n(max-min)
}
python中更加简洁
import random, string
def GB2312():
head = random.randint(0x4E00, 0x9FA5)
return head
s=''
for i in range(1000):
s=s+chr(GB2312())
print(s)
有疑问加站长微信联系(非本文作者)
![](https://static.golangjob.cn/static/img/footer.png?imageView2/2/w/280)