Py.–Random

 0    12 词汇卡    sir
下载mp3 打印 检查自己
 
问题 答案
A random item from a list, tuple, or string.
开始学习
choice(seq)
A randomly selected element from range(start, stop, step).
开始学习
randrange ([start,] stop [, step])
A random float r: 0<=r<1
开始学习
random()
Sets the integer starting value used in generating random numbers. Call this function before calling any other random module function. Returns None.
开始学习
seed([i'x])
Randomizes the items of a list in place. Returns None.
开始学习
shuffle(lst)
A random float r, belonging to [x; y)
开始学习
uniform(x, y)
Returns a list with a random selection from the given sequence
开始学习
choices(sequence, weights=None, cum_weights=None, k=1)
returns a list with a randomly selection of a specified number of items from a sequnce.
开始学习
sample(sequence, k)
Returns the current internal state of the random number generator
开始学习
getstate()
Returns a number representing the random bits
开始学习
getrandbits()
Get random integer in <start; stop>.
开始学习
randint(start, stop)
setstate (f'state)
开始学习
setstate(f'state)

您必须登录才能发表评论。