Py.–Random

 0    12 flashcards    sir
tải về mp3 In chơi tự kiểm tra
 
câu hỏi câu trả lời
A random item from a list, tuple, or string.
bắt đầu học
choice(seq)
A randomly selected element from range(start, stop, step).
bắt đầu học
randrange ([start,] stop [, step])
A random float r: 0<=r<1
bắt đầu học
random()
Sets the integer starting value used in generating random numbers. Call this function before calling any other random module function. Returns None.
bắt đầu học
seed([i'x])
Randomizes the items of a list in place. Returns None.
bắt đầu học
shuffle(lst)
A random float r, belonging to [x; y)
bắt đầu học
uniform(x, y)
Returns a list with a random selection from the given sequence
bắt đầu học
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.
bắt đầu học
sample(sequence, k)
Returns the current internal state of the random number generator
bắt đầu học
getstate()
Returns a number representing the random bits
bắt đầu học
getrandbits()
Get random integer in <start; stop>.
bắt đầu học
randint(start, stop)
setstate (f'state)
bắt đầu học
setstate(f'state)

Bạn phải đăng nhập để đăng bình luận.