Simple test code to draw the histogram for some simple random number generators sin frac shaer version html head script src https cdn plot ly plotly 2 32 0 min js script head body div id plot div script Define the random number generator function function myrandom st return fract Math cos dot st x 2 9 y 8 233 3758 3123 compare it with the javasript builtin random number generator return Math random different tuning parameters return fract Math sin st x 6 63 st y 732 9274 83293 1358024 console log myrandom myrandom x 0 5 y 0 5 Define the fract function function fract x return x Math floor x Define the dot function function dot a b return a x b x a y b y Create data for plotting var values for var u 0 u 500 u for var v 0 v 500 v var input x u y v Rectangle of values representing uv coordaintes var output myrandom input Generate random number using the function values push output Create histogram trace var trace x values type histogram marker color blue line color black width 1 Define layout options var layout title Histogram of Random Number Generator Output xaxis title Output Values yaxis title Frequency Plot the histogram Plotly newPlot plot trace layout script body html
urn a x b x a y b y Create data for plotting var values for var u 0 u 500 u for var v 0 v 500 v var input x u y v Rectangle of values representing uv coordaintes var output myrandom input Generate random number using the function values push output Create histogram trace var trace x values type histogram marker color blue line color black width 1 Define layout options var layout title Histogram of Random Number Generator Output xaxis title Output Values yaxis title Frequency Plot the histogram Plotly newPlot plot trace layout script body html