<commit_before><html>
  <head>
	<title>Flat distribution</title>
	<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-52254492-1', 'michalpaszkiewicz.co.uk');
  ga('send', 'pageview');
</script>
	</head>
<body>
	<h1>Distribution test : 50 days and 500,000 runs</h1>
	<h3>The problem: A function is to be run every (day) between two dates, deciding whether an action stops on that day. The probability of the action stopping on any day should be as similar to that of any of the others as possible.</h3>
	<h2>This doesn't work: ( 1/(numberOfDays) )</h2>
	<canvas id="oldCanvas"></canvas>
	<h2>This distribution is even less flat: ( dayNumber / numberOfDays )</h2>
	<canvas id="midCanvas"></canvas>
	<h2>This is the way to do it: ( 1/(numberOfDays - dayNumber) )</h2>
	<canvas id="newCanvas"></canvas>

	<style>
		html, body{
			width: 100%;
			margin: 0;
			padding: 0;
		}
		
		h1,h2,h3{
			text-align: center;
		}
	</style>
	
	<script>
		var probabilities = [];
		var oldProbabilities = [];
		var midProbabilities = [];
		
		var oldCanvas = document.getElementById("oldCanvas");
		var midCanvas = document.getElementById("midCanvas");
		var newCanvas = document.getElementById("newCanvas");
		
		var oldCtx = oldCanvas.getContext("2d");
		var midCtx = midCanvas.getContext("2d");
		var newCtx = newCanvas.getContext("2d");
		
		function getMax(score){
			var max = 0;
			for(var i = 0; i < score.length; i++){
				if(score[i] > max){
					max = score[i];
				}
			}
			return max;<commit_msg>Update flat-distribution.html<commit_after><html>
  <head>
	<title>Flat distribution</title>
	<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-52254492-1', 'michalpaszkiewicz.co.uk');
  ga('send', 'pageview');
</script>
	</head>
<body>
	<h1>Distribution test : 50 days and 500,000 runs</h1>
	<h3>The problem: A function is to be run every (day) between two dates, deciding whether an action stops on that day. The probability of the action stopping on any day should be as similar to that of any of the others as possible.</h3>
	<h2>This doesn't work: ( 1/(numberOfDays) )</h2>
	<canvas id="oldCanvas"></canvas>
	<h2>This distribution is even less flat: ( dayNumber / numberOfDays )</h2>
	<canvas id="midCanvas"></canvas>
	<h2>This is the way to do it: ( 1/(numberOfDays - dayNumber) )</h2>
	<canvas id="newCanvas"></canvas>

	<style>
		html, body{
			width: 100%;
			margin: 0;
			padding: 0;
		}
		
		h1, h2, h3{
			text-align: center;
		}
	</style>
	
	<script>
		var probabilities = [];
		var oldProbabilities = [];
		var midProbabilities = [];
		
		var oldCanvas = document.getElementById("oldCanvas");
		var midCanvas = document.getElementById("midCanvas");
		var newCanvas = document.getElementById("newCanvas");
		
		var oldCtx = oldCanvas.getContext("2d");
		var midCtx = midCanvas.getContext("2d");
		var newCtx = newCanvas.getContext("2d");
		
		function getMax(score){
			var max = 0;
			for(var i = 0; i < score.length; i++){
				if(score[i] > max){
					max = score[i];
				}
			}
			return max;
{'fraction_non_alphanumeric': 0.1801000555864369, 'fraction_numerical': 0.02501389660922735, 'mean_word_length': 4.339762611275964, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4376433', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1306, 'n_words': 308}