Example #1
0
def from_seed(seed, output_modulus=None):
    yield from lcg.from_seed(seed,
                             a=MULTIPLIER,
                             c=INCREMENT,
                             m=MODULUS,
                             masked_bits=SHIFT_BITS,
                             output_modulus=output_modulus)
Example #2
0
def handle_lcg(args):
    if args.seed:
        print_from_gen(
            lcg.from_seed(args.seed, args.multiplier, args.increment,
                          args.modulus, args.bitshift, args.modulo),
            args.count)
    else:
        print_from_gen(
            lcg.from_outputs(args.outputs, args.multiplier, args.increment,
                             args.modulus, args.bitshift, args.modulo),
            args.count)
Example #3
0
def handle_lcg(args):
    if args.seed:
        print_from_gen(lcg.from_seed(args.seed, args.multiplier,
                                     args.increment, args.modulus,
                                     args.bitshift, args.modulo),
                       args.count)
    else:
        print_from_gen(lcg.from_outputs(args.outputs, args.multiplier,
                                        args.increment, args.modulus,
                                        args.bitshift, args.modulo),
                       args.count)
Example #4
0
def from_seed(seed, output_modulus=None):
    yield from lcg.from_seed(seed, a=MULTIPLIER, c=INCREMENT, m=MODULUS,
                             masked_bits=SHIFT_BITS,
                             output_modulus=output_modulus)
Example #5
0
def from_seed(seed, bits):
    seed = (seed ^ 0x5DEECE66D) & ((1 << 48) - 1)
    gen = lcg.from_seed(seed, MULTIPLIER, INCREMENT, MODULUS, 0)
    for prediction in gen:
        yield prediction >> (48 - bits)
Example #6
0
def from_seed(seed, bits):
    seed = (seed ^ 0x5DEECE66D) & ((1 << 48) - 1)
    gen = lcg.from_seed(seed, MULTIPLIER,
                        INCREMENT, MODULUS, 0)
    for prediction in gen:
        yield prediction >> (48 - bits)