Generate the specified number of hash challenges.

        :param num: The number of hash challenges we want to generate.
        :param root_seed: Some value that we use to generate our seeds from.
177750
def generate_challenges(self, num, root_seed):
        

        # Generate a series of seeds
        seeds = self.generate_seeds(num, root_seed, self.secret)
        blocks = self.pick_blocks(num, root_seed)

        # List of 2-tuples (seed, hash_response)
        self.challenges = []

        # Generate the corresponding hash for each seed
        for i in range(num):
            self.challenges.append(Challenge(blocks[i], seeds[i]))
            response = self.meet_challenge(self.challenges[i])
            self.challenges[i].response = response
316393
public static function HashFromInt($num, int $seed = 5421087) :string
        {
            $scrambled = (324863748635 * $num + $seed) % 2654348974297586158321;

            $res = '';

            while ($scrambled) {
                $res       = self::BASE62_POOL[$scrambled % self::BASE62_BASE] . $res;
                $scrambled = intdiv($scrambled, self::BASE62_BASE);
            }

            $res = str_repeat('0', 12 - strlen($res)) . $res;

            return $res;
        }
1017212
def set(self, num):
        
        if self.validate(num) is not None:
            self.index = self.allowed.index(num)
        IntegerEntry.set(self, num)
564083
def set_random_seed():
  """"""
  tf.set_random_seed(FLAGS.random_seed)
  random.seed(FLAGS.random_seed)
  np.random.seed(FLAGS.random_seed)
16578
def _set_seed(self):
        
        if self.flags['SEED'] is not None:
            tf.set_random_seed(self.flags['SEED'])
            np.random.seed(self.flags['SEED'])
371661
private function seed()
    {
        $action = $this->arg->getParameter('action');

        if (!in_array($action, ['all', 'table'])) {
            $this->throwFailsCommand('This action is not exists', 'help seed');
        }

        if ($action == 'all') {
            if ($this->arg->getParameter('target') != null) {
                $this->throwFailsAction('Bad command usage', 'help seed');
            }
        }

        // Set command for understand
        $command = $action;

        $this->command->call(
            $command,
            'seeder',
            $this->arg->getParameter('target')
        );
    }
1192843
def add_aut_num_result(autnums)
      result = root.result

      @protocols.each do |protocol|
        result[protocol] ||= {}

        Array(autnums).each do |autnum|
          result[protocol][autnum] ||= []
        end
      end
    end
1311461
function(doit, checkit, seed) {
      var ret = [];
      var result = doit(seed);

      while (checkit(result)) {
        ret.push(result);
        result = doit(result);
      }

      return ret;
    }
241626
def generate_data_for_problem(problem):
  """"""
  training_gen, dev_gen, test_gen = _SUPPORTED_PROBLEM_GENERATORS[problem]

  num_train_shards = FLAGS.num_shards or 10
  tf.logging.info("Generating training data for %s.", problem)
  train_output_files = generator_utils.train_data_filenames(
      problem + generator_utils.UNSHUFFLED_SUFFIX, FLAGS.data_dir,
      num_train_shards)
  generator_utils.generate_files(training_gen(), train_output_files,
                                 FLAGS.max_cases)
  num_dev_shards = int(num_train_shards * 0.1)
  tf.logging.info("Generating development data for %s.", problem)
  dev_output_files = generator_utils.dev_data_filenames(
      problem + generator_utils.UNSHUFFLED_SUFFIX, FLAGS.data_dir,
      num_dev_shards)
  generator_utils.generate_files(dev_gen(), dev_output_files)
  num_test_shards = int(num_train_shards * 0.1)
  test_output_files = []
  test_gen_data = test_gen()
  if test_gen_data is not None:
    tf.logging.info("Generating test data for %s.", problem)
    test_output_files = generator_utils.test_data_filenames(
        problem + generator_utils.UNSHUFFLED_SUFFIX, FLAGS.data_dir,
        num_test_shards)
    generator_utils.generate_files(test_gen_data, test_output_files)
  all_output_files = train_output_files + dev_output_files + test_output_files
  generator_utils.shuffle_dataset(all_output_files)
811326
function generateHash( module, testName ) {
	var hex,
		i = 0,
		hash = 0,
		str = module + "\x1C" + testName,
		len = str.length;

	for ( ; i < len; i++ ) {
		hash  = ( ( hash << 5 ) - hash ) + str.charCodeAt( i );
		hash |= 0;
	}

	// Convert the possibly negative integer hash code into an 8 character hex string, which isn't
	// strictly necessary but increases user understanding that the id is a SHA-like hash
	hex = ( 0x100000000 + hash ).toString( 16 );
	if ( hex.length < 8 ) {
		hex = "0000000" + hex;
	}

	return hex.slice( -8 );
}
130911
def hash(self):
        '''
        
        '''
        hashed = super(RandomBits, self).hash()
        return khash(hashed, self._min_length, self._max_length, self._num_mutations, self._step, self._seed)
193091
def print_generated_sequence(gen, num, *, sep=", ", fmt='', seed=None):
    
    if seed:
       gen.reset(seed)

    elems = [format(next(gen), fmt) for _ in range(num)]
    sep_initial = "\n\n" if '\n' in sep else " "
    print("Generated sequence:{}{}".format(sep_initial, sep.join(elems)))
437565
def generate(num, prompt_default=True):
    """"""
    p = Problem(num)

    problem_text = p.text

    msg = "Generate file for problem %i?" % num
    click.confirm(msg, default=prompt_default, abort=True)

    # Allow skipped problem files to be recreated
    if p.glob:
        filename = str(p.file)
        msg = '"{}" already exists. Overwrite?'.format(filename)
        click.confirm(click.style(msg, fg='red'), abort=True)
    else:
        # Try to keep prefix consistent with existing files
        previous_file = Problem(num - 1).file
        prefix = previous_file.prefix if previous_file else ''
        filename = p.filename(prefix=prefix)

    header = 'Project Euler Problem %i' % num
    divider = '=' * len(header)
    text = '\n'.join([header, divider, '', problem_text])
    content = '\n'.join(['"""', text, '"""'])

    with open(filename, 'w') as f:
        f.write(content + '\n\n\n')

    click.secho('Successfully created "{}".'.format(filename), fg='green')

    # Copy over problem resources if required
    if p.resources:
        p.copy_resources()
66231
def set_seed(self, seed):

        

        assert seed.dtype == np.int and seed.shape == (self.samples, self.N)
        self.topic_seed = seed
1145235
def seed_rngs(seed: int) -> None:
    
    np.random.seed(seed)
    random.seed(seed)
    mx.random.seed(seed)
1347044
def root_hash
      # TODO: can I memoize computation below?
      return BLANK_ROOT if @root_node == BLANK_NODE

      raise InvalidNode, "invalid root node" unless @root_node.instance_of?(Array)

      val = FastRLP.encode @root_node
      key = Utils.keccak256 val

      @db.put key, val
      SPV.grabbing @root_node

      key
    end
1025382
public static function generateKeys($seed = null, $hashKey = '')
    {
        # The keys are being generated from a seed.
        if ($seed !== null) {
            # Generate some repeatable hashes to create keys against for recovery
            $encrHash = Hash::hash($seed, $hashKey, Constants::BOX_SEEDBYTES);
            $signHash = Hash::hash($seed, $hashKey, Constants::SIGN_SEEDBYTES);

            # Build recoverable pre-seeded key pairs.
            $seeds = [
                'encr' => \Sodium\crypto_box_keypair($encrHash),
                'sign' => \Sodium\crypto_sign_keypair($signHash),
            ];
        } else {
            # Build un-recoverable key pairs.
            $seeds = [
                'encr' => \Sodium\crypto_box_keypair(),
                'sign' => \Sodium\crypto_sign_keypair(),
            ];
        }

        # Return the two generated key pairs to the client.
        return [
            'encr' => [
                'pri' => Helpers::bin2hex(\Sodium\crypto_box_secretkey($seeds['encr'])),
                'pub' => Helpers::bin2hex(\Sodium\crypto_box_publickey($seeds['encr'])),
            ],
            'sign' => [
                'pri' => Helpers::bin2hex(\Sodium\crypto_sign_secretkey($seeds['sign'])),
                'pub' => Helpers::bin2hex(\Sodium\crypto_sign_publickey($seeds['sign'])),
            ],
        ];
    }