代碼很簡潔,每一個人能看得懂,很少說了。python
GO語言:dom
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中更加簡潔code
import random, string def GB2312(): head = random.randint(0x4E00, 0x9FA5) return head s='' for i in range(1000): s=s+chr(GB2312()) print(s)