Саргсян Тачат 321 RandBits 3222
ivio05 RandBits 3101
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    ones = random.sample(range(p), n)t6    bits = random.sample(range(p), n)
7    value = sum((1 << bit for bit in ones))7    x = sum((1 << b for b in bits))
8    return value8    return x
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op