#!/usr/bin/python # -*- coding: utf-8 -*- M = 2 ** 16 a = 997 b = 1 x = 12345 N = 100 f = lambda e: '{0:<06}'.format(round(e, 4)) arr = [] for _ in range(N): x = (a * x + b) % M arr.append(float(x) / M) print(''.join(e + ('\t' if i%10!=9 else '\n') for i, e in enumerate(map(lambda e: f(e), arr)))) print(''.join(e + ('\t' if (i+1)%10 else '\n') for i, e in enumerate(map(f, arr)))) print('平均={0}'.format(f(sum(arr) / N)))