JSFiddle - React, Tailwind, and code Playground

by Brock Whittaker

HTML

<script src="http://lavancier.com/brockCharts/API/GenerateRandomDist.js"></script>

JavaScript

array = [];
for (x = 0; x < 100000; x++) {
    GenerateRandomDist(1,0);
    array[x] = Math.round((1 - DailyReturn) * 1000) / 1000;
}

distribution = [];
z = 0;
for (x = -0.050; x <= 0.050; x = x + 0.001) {
    counter = 0;
    for (y = 0; y < array.length; y++) {
        if (array[y] < x) {
            counter++;
        }
    }
    distribution[z] = counter;
    z++;
}

actualDistribution = [];

for (x = 1; x < distribution.length; x++) {
    actualDistribution[x] = distribution[x] - distribution[x - 1];
}

for (x = 0; x < distribution.length; x++) {
    document.write(((x/1000) - 0.05) + " has a count of " + actualDistribution[x] + "<br />");
}