<commit_before>package br.com.dbsoft.tmp;



import org.joda.time.DateTime;
import org.joda.time.LocalDateTime;
import org.junit.Test;

import br.com.dbsoft.util.DBSDate;



public class Tmp {
	
	private static Integer Banco = 1;
	private static Integer Dtvm = 2;
	private static Integer Ctvm= 4;
	private static Integer Fundo = 8;
	
	@Test
	public void teste_x(){
	}	
	
//	@Test
	public void teste_bit(){
		Integer xImport = 0;
		
		xImport = xImport & ~Banco;
		System.out.println(xImport);
		
		xImport = xImport & ~Banco;
		System.out.println(xImport);
		
		xImport = xImport | Dtvm;
		System.out.println(xImport);
<commit_msg>teste galtonBoard<commit_after>package br.com.dbsoft.tmp;



import java.util.HashMap;
import java.util.Map;
import java.util.Random;

import org.joda.time.DateTime;
import org.joda.time.LocalDateTime;
import org.junit.Test;

import br.com.dbsoft.util.DBSDate;
import br.com.dbsoft.util.DBSFormat;
import br.com.dbsoft.util.DBSNumber;
import br.com.dbsoft.util.DBSObject;



public class Tmp {
	
	private static Integer Banco = 1;
	private static Integer Dtvm = 2;
	private static Integer Ctvm= 4;
	private static Integer Fundo = 8;
	
//	@Test
	public void galtonBoard(){
		Random xR = new Random();
		Integer xTotalBolas = 1000000;
		Integer xTotalVezes = 20;
		Integer xSoma = 0;
		Map<Integer, Integer> xSaldo = new HashMap<Integer, Integer>(); 
		Integer xZ = 0;
		Integer xU = 0;
//		Integer[] xInteger = new Integer[xTotalVezes];
		for (int xA=1;xA <= xTotalBolas;xA++){
			xSoma = 0;
			for (int xI=1;xI <= xTotalVezes;xI++){
				int xB = xR.nextInt(2);
				if (xB == 0){
					xSoma--;
					xZ++;
				}else if (xB == 1){
					xSoma++;
					xU++;
				}else{
					System.out.println("STOP");
				}
			}
			xSaldo.put(xSoma, DBSObject.getNotNull(xSaldo.get(xSoma),0) + 1);
		}
		System.out.println("0=" + xZ);
		System.out.println("1=" + xU);
		for (Integer xKey: xSaldo.keySet()){
			System.out.println(xKey + "\t" + xSaldo.get(xKey) + "\t" + DBSFormat.getFormattedNumber(DBSNumber.multiply(DBSNumber.divide(xSaldo.get(xKey), xTotalBolas), 100), 2));
		}
	}	
	
	@Test
	public void galtonBoard2(){
		Random xR = new Random();
		Integer xTotalBolas = 1000000;
		Integer xSoma = 0;
		Map<Integer, Integer> xSaldo = new HashMap<Integer, Integer>(); 
		Integer xZ = 0;
		Integer xU = 0;
		Integer xAnterior = 0;
//		Integer[] xInteger = new Integer[xTotalVezes];
		for (int xA=1;xA <= xTotalBolas;xA++){
			int xAtual = xR.nextInt(2);
			if (xAtual == 0){
				xSoma--;
				xZ++;
			}else if (xAtual == 1){
				xSoma++;
				xU++;
			}
			if (xAtual == xAnterior){
				xSaldo.put(xSoma, DBSObject.getNotNull(xSaldo.get(xSoma),0) + 1);
			}else{
				xAnterior = xAtual;
				xSoma = 1;
			}
		}
		System.out.println("0=" + xZ);
		System.out.println("1=" + xU);
		for (Integer xKey: xSaldo.keySet()){
			System.out.println(xKey + "\t" + xSaldo.get(xKey) + "\t" + DBSFormat.getFormattedNumber(DBSNumber.multiply(DBSNumber.divide(xSaldo.get(xKey), xTotalBolas), 100), 4));
		}
	}	

	//	@Test
	public void teste_bit(){
		Integer xImport = 0;
		
		xImport = xImport & ~Banco;
		System.out.println(xImport);
		
		xImport = xImport & ~Banco;
		System.out.println(xImport);
		
		xImport = xImport | Dtvm;
		System.out.println(xImport);

{'fraction_non_alphanumeric': 0.15207373271889402, 'fraction_numerical': 0.018740399385560675, 'mean_word_length': 3.4299319727891158, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 7, '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': '963610', 'n_tokens_mistral': 1486, 'n_tokens_neox': 1270, 'n_words': 277}