<commit_before>package org.telegram.mtproto.secure;

import java.security.SecureRandom;

import static org.telegram.mtproto.secure.CryptoUtils.xor;

/**
 * Created with IntelliJ IDEA.
 * User: ex3ndr
 * Date: 03.11.13
 * Time: 4:05
 */
public final class Entropy {
    private static SecureRandom random = new SecureRandom();

    public static byte[] generateSeed(int size) {
        return random.generateSeed(size);
    }

    public static byte[] generateSeed(byte[] sourceSeed) {
        return xor(random.generateSeed(sourceSeed.length), sourceSeed);
    }

    public static long generateRandomId() {
        return random.nextLong();
    }

    public static int randomInt() {
        return random.nextInt();
    }

    public static void feedEntropy(byte[] data) {
        random.setSeed(data);
    }
}<commit_msg>Added synchronized to SecureRandom in Entropy<commit_after>package org.telegram.mtproto.secure;

import java.security.SecureRandom;

import static org.telegram.mtproto.secure.CryptoUtils.xor;

/**
 * Created with IntelliJ IDEA.
 * User: ex3ndr
 * Date: 03.11.13
 * Time: 4:05
 */
public final class Entropy {
    private static SecureRandom random = new SecureRandom();

    public static byte[] generateSeed(int size) {
        synchronized (random) {
            return random.generateSeed(size);
        }
    }

    public static byte[] generateSeed(byte[] sourceSeed) {
        synchronized (random) {
            return xor(random.generateSeed(sourceSeed.length), sourceSeed);
        }
    }

    public static long generateRandomId() {
        synchronized (random) {
            return random.nextLong();
        }
    }

    public static int randomInt() {
        synchronized (random) {
            return random.nextInt();
        }
    }

    public static void feedEntropy(byte[] data) {
        synchronized (random) {
            random.setSeed(data);
        }
    }
}
{'fraction_non_alphanumeric': 0.10471204188481675, 'fraction_numerical': 0.010471204188481676, 'mean_word_length': 2.689189189189189, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4437310', 'n_tokens_mistral': 585, 'n_tokens_neox': 562, 'n_words': 135}