Add CSPRNG option: --securerandom

This commit is contained in:
Kevin Cathcart
2020-06-26 20:12:30 -04:00
parent 90d1353ae6
commit 4ad31d641b
11 changed files with 62 additions and 11 deletions

View File

@@ -4,7 +4,7 @@ from itertools import zip_longest
import json
import logging
import os
import random
import RaceRandom as random
import time
from BaseClasses import World, CollectionState, Item, Region, Location, Shop
@@ -23,6 +23,9 @@ __version__ = '0.6.3-pre'
def main(args, seed=None):
start = time.perf_counter()
if args.securerandom:
random.use_secure()
# initialize the world
world = World(args.multi, args.shuffle, args.logic, args.mode, args.swords, args.difficulty, args.item_functionality, args.timer, args.progressive, args.goal, args.algorithm, not args.nodungeonitems, args.accessibility, args.shuffleganon, args.quickswap, args.fastmenu, args.disablemusic, args.keysanity, args.retro, args.custom, args.customitemarray, args.shufflebosses, args.hints)
logger = logging.getLogger('')
@@ -33,6 +36,9 @@ def main(args, seed=None):
world.seed = int(seed)
random.seed(world.seed)
if args.securerandom:
world.seed = None
world.crystals_needed_for_ganon = random.randint(0, 7) if args.crystals_ganon == 'random' else int(args.crystals_ganon)
world.crystals_needed_for_gt = random.randint(0, 7) if args.crystals_gt == 'random' else int(args.crystals_gt)