2019年1月29日 星期二

Random Number


The following code will print 10 pseudo-random integers between 1 and 100

import random
for x in range(10):
  print random.randint(1,101)
For security or cryptographic uses, see the secrets module.
https://docs.python.org/3/library/random.html


random.seed(a=Noneversion=2)

random.randrange(startstop[step])
random.randint(ab)
random.random()

沒有留言:

張貼留言

Binary Data, String, and Integer Conversions in Python

In Python 3, struct  will interpret bytes as packed binary data: This module performs conversions between Python values and C structs rep...