squizyCake RandBits 4215
Антипова Алёна 425 гр. RandBits 2830
f1import randomf1import random
22
3def randbits(p, n):3def randbits(p, n):
4    if not 1 <= n <= p:4    if not 1 <= n <= p:
5        return 05        return 0
t6    pos = random.sample(range(p), n)t6    position = random.sample(range(p), n)
7    x = 07    num = 0
8    for i in pos:8    for pos in position:
9        x |= 1 << i9        num |= 1 << pos
10    return x10    return num
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op