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