JSFiddle - React, Tailwind, and code Playground

JavaScript

var balance = 1000;
const maxProfit = 0.5; //set to 0.01 for 1x kelly
const oddsRatio = 2.0;
const houseEdge = 0.01;

// Helpers:
function didWin() {
	return Math.random() < 1 * (1 + houseEdge)/oddsRatio;
}

function enterCash(cash) {
	if (!didWin()) {
  	return 0;
  }
    
  return cash * oddsRatio;
}

// Main:
for (var j = 0; j < 100; j++) {
  const betAmount = balance * maxProfit;
  balance -= betAmount;
  balance += enterCash(betAmount);
  console.log("balance", balance);
}