var code = myRound(30,100); function myRound(begin,end){ var num = Math.round(Math.random()*(end-begin)+begin); return num; }