Indeed, the X := reverse( A*X + B ) operation (everything mod 2^w) strikes me as, quite possibly, a pretty good random generator, if the constants A and B are chosen correctly. A should be odd. (If A=even then the map is a 2-to-1-fold, or more-fold, uninvertible map and hence large periods cannot be expected.) With A=1, here are some max-period examples found by random trial. It empirically looks as though max possible period 2^w is achievable exactly when w is odd, (except also when w=2), and the C that accomplishes this empirically always is odd. [Which I now have forced in my search program so it can be twice as fast. It makes a lot of intuitive sense to me that odd C should be preferable, but I have no proof.] The values of C and the periods are in hexadecimal: Seeking C so that X := reverse(X+C) has large period mod 2^w. w=1 C=1 period=2 (max possible, trials=1) w=3 C=7 period=8 (max possible, trials=1) w=5 C=3 period=20 (max possible, trials=1) w=7 C=1 period=80 (max possible, trials=2) w=9 C=1DB period=200 (max possible, trials=3) w=11 C=2D7 period=800 (max possible, trials=31) w=13 C=1D73 period=2000 (max possible, trials=38) w=15 C=31A7 period=8000 (max possible, trials=65) w=17 C=21A3 period=20000 (max possible, trials=205) w=19 C=1F64B period=80000 (max possible, trials=2691) w=21 C=62D8D period=200000 (max possible, trials=292) w=23 C=7D9DDB period=800000 (max possible, trials=2105) w=25 C=1E40F47 period=2000000 (max possible, trials=2443) Theorem: if C works to yield max-period, then (-C) also works. Proof: Consider time-reversal. For general A and B, with A=odd, but B having unrestricted parity, it appears that max-period 2^w is achievable for every w>0, although examples are quite hard to find. Here are some max-period cases (again A,B,period in hexadecimal): Seeking A,B so that X := reverse(A*X+B) has large period mod 2^w. w=1 A=1 B=1 period=2 (max possible, trials=3) w=2 A=3 B=1 period=4 (max possible, trials=1) w=3 A=1 B=1 period=8 (max possible, trials=9) w=4 A=B B=8 period=10 (max possible, trials=16) w=5 A=1 B=1F period=20 (max possible, trials=12) w=6 A=3B B=14 period=40 (max possible, trials=64) w=7 A=23 B=68 period=80 (max possible, trials=38) w=8 A=55 B=75 period=100 (max possible, trials=433) w=9 A=1F7 B=DA period=200 (max possible, trials=154) w=10 A=381 B=15F period=400 (max possible, trials=605) w=11 A=223 B=34A period=800 (max possible, trials=1079) w=12 A=147 B=4D8 period=1000 (max possible, trials=12774) w=13 A=1183 B=129A period=2000 (max possible, trials=550) w=14 A=3897 B=274C period=4000 (max possible, trials=10047) w=15 A=7C0D B=3C9 period=8000 (max possible, trials=33331) w=16 A=4803 B=43F6 period=10000 (max possible, trials=29402) -- Warren D. Smith http://RangeVoting.org <-- add your endorsement (by clicking "endorse" as 1st step)