JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
Шанс <input type="text" id='chance' value='50'> <Br>
Подряд минусов - <span id='loss'></span><br>
Подряд плюсов - <span id='win'></span><br>
Всего плюсов - <span id='total_win'></span><br>
Всего минусов - <span id='total_loss'></span><br>
<button id='calc'>
Расчитать
</button>

JavaScript

function randomInteger(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
}

$('#calc').click(function(){
	calc();
});


function calc(){
var max_loos  = 0;
var max_win  = 0;
var win = 0;
var loos = 0;
var total_win = 0;
var total_loos = 0;
	
var chance = 1000000-$('#chance').val()*10000;  
  
  
for(i = 1; i <= 100000; i++){
	
		my_bit = randomInteger(0,999999);		
//		dice_bit = randomInteger(0,999999);
	dice_bit = chance
	
		if(dice_bit > my_bit){

			win = 0;
			
			loos ++;
			
			if(loos > max_loos)
				max_loos =loos;
		
			total_loos ++;
		
		
		}else{
			
			//echo 'WIN '.$dice_bit.'-'.$my_bit.'<br>';
			
			loos = 0;
			
			win ++;
			
			if(win > max_win)
				max_win = win;
		
			total_win ++;
		
		}
	
		
	
	}
	
	
//	echo 'WIN   '.max_win.'----'.max_loos.'   LOOS <Br>';
//	echo 'TOTAL WIN   '.total_win.'----'.total_loos.'  TOTAL LOOS <BR>';
//alert(max_loos+'-'+max_win);

$('#loss').html(max_loos);
$('#win').html(max_win);
$('#total_loss').html(total_loos);
$('#total_win').html(total_win);
}