Долгих Данила RandBits 3191
Ли Гэнцзэ 321 RandBits 3292
f1import randomf1import random
22
3def randbits(p, n):3def randbits(p, n):
4    if n > p or n <= 0:4    if n > p or n <= 0:
5        return 05        return 0
6    positions = random.sample(range(p), n)6    positions = random.sample(range(p), n)
n7    result = 0n7    num = 0
8    for pos in positions:8    for pos in positions:
t9        result |= 1 << post9        num |= 1 << pos
10    return result10    return num
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op