I tried to make the combination of 6 with 5
times. Like from 1 to 6 I want to generate randomly similarly 7 to 12
and 13 to 18
upto 25 to 30
.
I tried this like
setInterval(function() {
var number = 1 + Math.floor(Math.random() * 6); //i tried from 1 to 6
$('#my_div1').text(number);
var number = 7 + Math.floor(Math.random() * 12); // i tried from 7 to 12
$('#my_div2').text(number);
var number = 13 + Math.floor(Math.random() * 18); // from 13 to 18
$('#my_div3').text(number);
var number = 19 + Math.floor(Math.random() * 24); //from 19 to 24
$('#my_div4').text(number);
var number = 25 + Math.floor(Math.random() * 30); // from 25 to 30
$('#my_div5').text(number);
},
1000);
For the first one itself is working for the next i didn't get proper value. I tried this previously in php with rand(1,5);
like that But i am not sure how to do this in javascript. Any Suggestion would be great.
Here is the Fiddle