I am in search of a way to translate an R Script into JavaScript for the purpose of dynamically altering a HighCharts.js plot. However, I am unsure how to go about creating a JavaScript function that can replicate the functionality of the rnorm() function in R. Any guidance on approaching this type of challenge would be greatly valued.
Here is the R code:
## generate random normal variables with accurate mean and standard deviations
RHT <- round(rnorm(50, mean= HTot, sd= HtX))
RAT <- round(rnorm(50, mean= ATot , sd= AtX))
## combine data
ranScor <- cbind(RHT,RAT)
ranScor <- data.frame(ranScor)
### create a simple line graph
plot(RHT,type="b", col= "blue", lwd=1, ylim=c(min(ranScor),max(ranScor)),xlab="Game Simulations",ylab="Team Score", main="Random Score Generator", sub="Indianapolis Colts @ Denver Broncos")
lines(RAT, type="b", col="red",lwd=1)
legend("topleft",legend=c("HomeTeam","AwayTeam"),lty=1,col=c("blue","red"),lwd=2,cex=.7)