Commit 4063cf21 authored by Christoph Conrads's avatar Christoph Conrads

Print only integer powers period length

Display `2^234` instead of `2^234.56` and so on.
parent 623bec77
...@@ -246,8 +246,6 @@ def main(): ...@@ -246,8 +246,6 @@ def main():
sys.exit(3) sys.exit(3)
m = compute_modulus(b, r, s) m = compute_modulus(b, r, s)
#print('b=2^{:d} r={:d} s={:d}'.format(w, r, s))
key = (kind, w, r, s) key = (kind, w, r, s)
ps = \ ps = \
...@@ -260,8 +258,6 @@ def main(): ...@@ -260,8 +258,6 @@ def main():
ps_awc_32_29_17 if kind=='awc' and w== 32 and r == 29 and s == 17 else \ ps_awc_32_29_17 if kind=='awc' and w== 32 and r == 29 and s == 17 else \
factorize(kind, w, r, s, m-1) factorize(kind, w, r, s, m-1)
#print('Found {:d} prime factors'.format(len(ps)))
assert ps is None or (m-1) % reduce(operator.mul, ps, 1) == 0 assert ps is None or (m-1) % reduce(operator.mul, ps, 1) == 0
min_period, max_period = \ min_period, max_period = \
...@@ -271,11 +267,12 @@ def main(): ...@@ -271,11 +267,12 @@ def main():
p2_min = math.log(min_period) / math.log(2) p2_min = math.log(min_period) / math.log(2)
p2_max = math.log(max_period) / math.log(2) p2_max = math.log(max_period) / math.log(2)
floor = lambda x: int(math.floor(x))
msg = '{:4d} {:4d} {:3d} {:3d}'
out = msg.format(floor(p2_min),floor(p2_max),floor(p10_min),floor(p10_max))
#print('Period length 2^{:.2f} 2^{:.2f}'.format(p2_min, p2_max)) print(out)
#print('Period length 10^{:.2f} 10^{:.2f}'.format(p10_min, p10_max))
msg = '{:7.2f} {:7.2f} {:6.2f} {:6.2f}'
print(msg.format(p2_min, p2_max, p10_min, p10_max))
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -166,7 +166,7 @@ find_awc_swb_prngs() ...@@ -166,7 +166,7 @@ find_awc_swb_prngs()
echo "Found $num_generators $type parameter combinations" echo "Found $num_generators $type parameter combinations"
echo 'type b r s t log2period log10period' echo 'type b r s t log2period log10period'
while read gen while read gen
do do
local b="$(awk '{print $2}' <<<"$gen")" local b="$(awk '{print $2}' <<<"$gen")"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment