I once read on Habre one convenient way, but apparently forgotten it already...
let's say we have 101010
the first three digits(or bit right) is a 5, is simply to remember
0 is just multiplication by two, for a total of 10
1 — multiply by 2 and add unit, for a total of 21
0 — multiply by 2, total epic 42.
Like everything is fine, but when I wrote the random number is more(this was 91), switch right it could not have...
Maybe someone knows about this method?