Generate an anomaly. This is done
        via a Psuedo-random number generator.
544088
def generate_anomaly(self, input_word, list_of_dict_words, num):
        

        results = []
        for i in range(0,num):
            index = randint(0,len(list_of_dict_words)-1)
            name = list_of_dict_words[index]
            if name != input_word and name not in results:
                results.append(PataLib().strip_underscore(name))
            else:
                i = i +1
        results = {'input' : input_word, 'results' : results, 'category' : 'anomaly'} 
        return results
311874
private SecureRandom createSecureRandom()
    {

        SecureRandom result = null;

        long t1 = System.currentTimeMillis();
        if (secureRandomClass != null)
        {
            try
            {
                // Construct and seed a new random number generator
                Class<?> clazz = Class.forName(secureRandomClass);
                result = (SecureRandom) clazz.newInstance();
            }
            catch (Exception e)
            {
                log.log(Level.SEVERE, "Exception initializing random number generator of class "+ 
                        secureRandomClass + ". Falling back to java.secure.SecureRandom", e);
            }
        }

        if (result == null)
        {
            // No secureRandomClass or creation failed. Use SecureRandom.
            try
            {
                if (secureRandomProvider != null
                        && secureRandomProvider.length() > 0)
                {
                    result = SecureRandom.getInstance(secureRandomAlgorithm,
                            secureRandomProvider);
                }
                else
                {
                    if (secureRandomAlgorithm != null
                            && secureRandomAlgorithm.length() > 0)
                    {
                        result = SecureRandom.getInstance(secureRandomAlgorithm);
                    }
                }
            }
            catch (NoSuchAlgorithmException e)
            {
                log.log(Level.SEVERE, "Exception initializing random number generator using algorithm: "+
                        secureRandomAlgorithm, e);
            }
            catch (NoSuchProviderException e)
            {
                log.log(Level.SEVERE, "Exception initializing random number generator using provider: " + 
                        secureRandomProvider, e);
            }
        }

        if (result == null)
        {
            // Invalid provider / algorithm
            try
            {
                result = SecureRandom.getInstance("SHA1PRNG");
            }
            catch (NoSuchAlgorithmException e)
            {
                log.log(Level.SEVERE, "Invalid provider / algoritm SHA1PRNG for generate secure random token", e);
            }
        }

        if (result == null)
        {
            // Nothing works - use platform default
            result = new SecureRandom();
        }

        // Force seeding to take place
        result.nextInt();

        long t2 = System.currentTimeMillis();
        if ((t2 - t1) > 100)
        {
            if (log.isLoggable(Level.FINEST))
            {
                log.info("Creation of SecureRandom instance for session ID generation using ["
                        +result.getAlgorithm()+"] took ["+Long.valueOf(t2 - t1)+"] milliseconds.");
            }
        }
        return result;
    }
589261
private void doGenerateIncrements() {
		if(increments != null) {
			return;	// Nothing to do
		}

		// Create random number sequence generator
		MersenneTwister mersenneTwister = new MersenneTwister(seed);

		// Allocate memory
		double[][][] incrementsArray = new double[timeDiscretization.getNumberOfTimeSteps()][jumpIntensities.length][numberOfPaths];

		// Pre-calculate Poisson distributions
		PoissonDistribution[][] poissonDistribution = new PoissonDistribution[timeDiscretization.getNumberOfTimeSteps()][jumpIntensities.length];
		for(int timeIndex=0; timeIndex<timeDiscretization.getNumberOfTimeSteps(); timeIndex++) {
			for(int factorIndex=0; factorIndex<jumpIntensities.length; factorIndex++) {
				poissonDistribution[timeIndex][factorIndex] = new PoissonDistribution(timeDiscretization.getTimeStep(timeIndex)*jumpIntensities[factorIndex]);
			}
		}


		/*
		 * Generate independent increments.
		 *
		 * The inner loop goes over time and factors.
		 * MersenneTwister is known to generate "independent" increments in 623 dimensions.
		 * Since we want to generate independent streams (paths), the loop over path is the outer loop.
		 */
		for(int pathIndex=0; pathIndex<numberOfPaths; pathIndex++) {
			for(int timeIndex=0; timeIndex<timeDiscretization.getNumberOfTimeSteps(); timeIndex++) {
				for(int factorIndex=0; factorIndex<jumpIntensities.length; factorIndex++) {
					double uniformIncrement = mersenneTwister.nextDouble();
					double numberOfJumps = poissonDistribution[timeIndex][factorIndex].inverseCumulativeDistribution(uniformIncrement);

					incrementsArray[timeIndex][factorIndex][pathIndex] = numberOfJumps;
				}
			}
		}

		// Allocate memory for RandomVariable wrapper objects.
		increments = new RandomVariableInterface[timeDiscretization.getNumberOfTimeSteps()][jumpIntensities.length];

		// Wrap the values in RandomVariable objects
		for(int timeIndex=0; timeIndex<timeDiscretization.getNumberOfTimeSteps(); timeIndex++) {
			double time = timeDiscretization.getTime(timeIndex+1);
			for(int factor=0; factor<jumpIntensities.length; factor++) {
				increments[timeIndex][factor] =
						randomVariableFactory.createRandomVariable(time, incrementsArray[timeIndex][factor]);
			}
		}
	}
1225139
def generate(length):
    """"""
    if not isinstance(length, int) or length < 2:
        raise TypeError('length must be a positive integer greater than 1.')

    # first digit cannot be 0
    digits = [random.randint(1, 9)]

    for i in range(length-2):
        digits.append(random.randint(0, 9))
    digits.append(get_check_digit(''.join(map(str, digits))))

    return ''.join(map(str, digits))
1116992
def _generate_number(self, prefix, length):
        
        number = prefix
        # Generate random char digits
        number += '#' * (length - len(prefix) - 1)
        number = self.numerify(number)
        reverse = number[::-1]
        # Calculate sum
        tot = 0
        pos = 0
        while pos < length - 1:
            tot += Provider.luhn_lookup[reverse[pos]]
            if pos != (length - 2):
                tot += int(reverse[pos + 1])
            pos += 2
        # Calculate check digit
        check_digit = (10 - (tot % 10)) % 10
        number += str(check_digit)
        return number
491023
def generate(self):
        '''
        
        '''
        generated_arr = np.random.uniform(low=self.__low, high=self.__high, size=self.__output_shape)
        if self.noise_sampler is not None:
            self.noise_sampler.output_shape = generated_arr.shape
            generated_arr += self.noise_sampler.generate()
        return generated_arr
1331504
function _generateUUID() {
        var result,
            numericSeed;
        for (
            result = numericSeed = '';
            numericSeed++ < 36;
            result += numericSeed * 51 & 52 ? (numericSeed ^ 15 ? 8 ^ Math.random() * (numericSeed ^ 20 ? 16 : 4) : 4).toString(16) : '-'
        );

        return result;
    }
600763
def randomprune(self,n):
        """"""
        self.data = random.sample(self.data, n)
737917
def gen_secret(length=64):
    
    charset = string.ascii_letters + string.digits
    return ''.join(random.SystemRandom().choice(charset)
                   for _ in range(length))
150756
def generate(cls):
        
        return cls(
            random(nacl.bindings.crypto_sign_SEEDBYTES),
            encoder=encoding.RawEncoder,
        )
775842
def _generate(self, size=None):
        ""
        corpus_letters = list(self.vectors.keys())
        current_letter = random.choice(corpus_letters)
        if size is None:
            size = int(random.normalvariate(self.avg, self.std_dev))

        letters = [current_letter]

        for _ in range(size):
            if current_letter not in corpus_letters:
                # current_letter = random.choice(corpus_letters)
                break
            found_letter = self.vectors[current_letter].choose()
            letters.append(found_letter)
            current_letter = found_letter

        return ''.join(letters)
571905
def get_anomalies(smoothed_errors, y_true, z, window, all_anomalies, error_buffer):
    

    mu = np.mean(smoothed_errors)
    sigma = np.std(smoothed_errors)

    epsilon = mu + (z * sigma)

    # compare to epsilon
    errors_seq, anomaly_indices, max_error_below_e = group_consecutive_anomalies(
        smoothed_errors,
        epsilon,
        y_true,
        error_buffer,
        window,
        all_anomalies
    )

    if len(errors_seq) > 0:
        anomaly_indices = prune_anomalies(
            errors_seq,
            smoothed_errors,
            max_error_below_e,
            anomaly_indices
        )

    return anomaly_indices
1109872
def random(cls):
        """"""
        axis = random_unit()
        angle = np.random.uniform(0,2*np.pi)
        invert = bool(np.random.randint(0,2))
        return Rotation.from_properties(angle, axis, invert)
827017
def ensure_rng(random_state=None):
    
    if random_state is None:
        random_state = np.random.RandomState()
    elif isinstance(random_state, int):
        random_state = np.random.RandomState(random_state)
    else:
        assert isinstance(random_state, np.random.RandomState)
    return random_state
1273853
def get_rng(obj=None):
    
    seed = (id(obj) + os.getpid() +
            int(datetime.now().strftime("%Y%m%d%H%M%S%f"))) % 4294967295
    if _RNG_SEED is not None:
        seed = _RNG_SEED
    return np.random.RandomState(seed)
612547
def p_generate_items(self, p):
        ''
        p[0] = p[1] + (p[2],)
        p.set_lineno(0, p.lineno(1))
426452
def generate(cls):
        
        return cls(
            libnacl.randombytes(libnacl.crypto_sign_SEEDBYTES),
            encoder=encoding.RawEncoder,
        )