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