<commit_before>/* ******************************************************************************
 * 
 * This file is part of Optsicom
 * 
 * License:
 *   EPL: http://www.eclipse.org/legal/epl-v10.html
 *   LGPL 3.0: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
 *   See the LICENSE file in the project's top-level directory for details.
 *
 * **************************************************************************** */
package es.optsicom.lib.util;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class RandomManager {

	private static Random random = new Random();
	
	//private static List<Number> randomNumbers = new ArrayList<Number>();
	//private static int numRandoms = 0;
	
	public static int nextInt(int number){
		int nextInt = random.nextInt(number);
		//System.out.println("RI:"+nextInt);
		//randomNumbers.add(nextInt);
		return nextInt;
	}
	
	public static double nextDouble() {
		double nextDouble = random.nextDouble();
		//System.out.println("RD:"+nextDouble);
		//randomNumbers.add(nextDouble);
		return nextDouble;
	}
	
	public static void setSeed(long seed) {
		System.out.println("Using seed: " + seed);
		random = new Random(seed);
//		if(randomNumbers.size() != 0){
//			try {
//				Writer out = new BufferedWriter(new FileWriter(new File("randoms/random"+numRandoms+".txt")));
//				long numRan = 0;
//				for(Number number : randomNumbers){
//					out.append(numRan+"\t"+number+"\n");
//					numRan++;
//				}				
//				randomNumbers.clear();
//				out.close();
//				System.out.println("Saved!!!");
//			} catch (IOException e) {
//				e.printStackTrace();
//			}
//			numRandoms++;
//		}
	}	

}
<commit_msg>new random function<commit_after>/* ******************************************************************************
 * 
 * This file is part of Optsicom
 * 
 * License:
 *   EPL: http://www.eclipse.org/legal/epl-v10.html
 *   LGPL 3.0: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
 *   See the LICENSE file in the project's top-level directory for details.
 *
 * **************************************************************************** */
package es.optsicom.lib.util;

import java.util.Random;

public class RandomManager {

	private static Random random = new Random();
	
	//private static List<Number> randomNumbers = new ArrayList<Number>();
	//private static int numRandoms = 0;
	
	public static int nextInt(int number){
		int nextInt = random.nextInt(number);
		//System.out.println("RI:"+nextInt);
		//randomNumbers.add(nextInt);
		return nextInt;
	}
	
	/**
	 * Next random int between begin and end, both inclusive
	 * @param begin
	 * @param end
	 * @return int
	 */
	public static int nextInt(int begin, int end) {
		if (end - begin == 0) {
			return end;
		}
		int nextInt = nextInt(end - begin + 1);
		return nextInt + begin;
	}
	
	public static double nextDouble() {
		double nextDouble = random.nextDouble();
		//System.out.println("RD:"+nextDouble);
		//randomNumbers.add(nextDouble);
		return nextDouble;
	}
	
	public static void setSeed(long seed) {
		System.out.println("Using seed: " + seed);
		random = new Random(seed);
//		if(randomNumbers.size() != 0){
//			try {
//				Writer out = new BufferedWriter(new FileWriter(new File("randoms/random"+numRandoms+".txt")));
//				long numRan = 0;
//				for(Number number : randomNumbers){
//					out.append(numRan+"\t"+number+"\n");
//					numRan++;
//				}				
//				randomNumbers.clear();
//				out.close();
//				System.out.println("Saved!!!");
//			} catch (IOException e) {
//				e.printStackTrace();
//			}
//			numRandoms++;
//		}
	}	

}

{'fraction_non_alphanumeric': 0.23231511254019294, 'fraction_numerical': 0.0053590568060021436, 'mean_word_length': 3.5030156815440288, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '5938254', 'n_tokens_mistral': 1329, 'n_tokens_neox': 1175, 'n_words': 266}