<commit_before>


function  SimObject(SimSize)
{
	this.Infected=SimSize;
	this.Diagnosed=Diagnosed;
}<commit_msg>Creating time until event<commit_after>


function  SimObject(SimSize)
{
	this.Infected=SimSize;
	this.Diagnosed=Diagnosed;
}










// General mathematical functions that are used during simulations

function TimeUntilEvent(Probability)
{
	// r=annual probability
	// p=random number between 0 and 1
	// p=r^t
	// p=e^(ln(r)t)
	// t=ln(p)/ln(r)
	
	return (Math.log(Math.random())/Math.log(Probability));
}

for (var i=1; i<10000; i++)
{
	console.log(TimeUntilEvent(0.3));
}
{'fraction_non_alphanumeric': 0.14915254237288136, 'fraction_numerical': 0.01694915254237288, 'mean_word_length': 4.422018348623853, 'pattern_counts': {'":': 0, '<': 4, '<?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': '2054092', 'n_tokens_mistral': 238, 'n_tokens_neox': 216, 'n_words': 42}