Гудов Дмитрий 321 RandBits 3392
Ващенко Алёна Дмитриевна, 418 гр. RandBits 2836
f1import randomf1import random
22
3def randbits(p, n):3def randbits(p, n):
n4    if p < n:n4    if n > p:
5        return 05        return 0
t6    pos = random.sample(range(p), n)t6    ones_positions = random.sample(range(p), n)
7    x = 07    number = 0
8    for i in pos:8    for position in ones_positions:
9        x |= 1 << i9        number |= 1 << position
10    return x10    return number
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op