EXPERIMENT Find a suitable modulus for a multi-stream Lehmer pseudo-random generator. Input: number of bits to represent the modulus. Output: the largest prime number that can be represented by k bits, i.e. less than or equal to 2^(k-1)-1. Notes: results are stored in folder 'out/modulus'. """ from os import path from pydes.core.rnd.inspection import modulus_finder from pydes.core.utils.logutils import get_logger from pydes.core.utils.report import SimpleReport # Logging logger = get_logger(__name__) # Defaults DEFAULT_BITS = 32 DEFAULT_OUTDIR = "out/modulus" def run(bits, outdir=DEFAULT_OUTDIR): """ Find a modulus for the given number of bits. :param bits: (int) number of bits; must be positive. :param outdir: (str) path to the output directory. """ logger.info("Computing modulus for Bits {}".format(bits)) filename = path.join(outdir, "mod{}.txt".format(bits))
from pydes.core.rnd.rndgen import MarcianiMultiStream, MarcianiSingleStream from pydes.core.utils import guiutils, logutils from pydes.exp.analytical import analytical_solution from pydes.exp.rnd import ( extremes, jumpfind, kolmogorov_smirnov, modulus, mulcheck, mulfind, spectral, ) from pydes.exp.simulation import performance_analysis, transient_analysis, validation logger = logutils.get_logger(__name__) @click.group(invoke_without_command=True, context_settings=dict(max_content_width=120)) @click.option("--debug/--no-debug", default=False, show_default=True, type=bool, help="Activate/Deactivate debug mode.") @click.pass_context @click.version_option(version="0.0.1") def main(ctx, debug): print(guiutils.get_splash()) if ctx.invoked_subcommand is None: print(ctx.get_help())