Question: 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](http://jsfiddle.net/bxZ9G/5/)**

Answer: 
You almost got it right. The problem is you still multiply the random generated number by the whole amount, so you performed `7 + a random number between 1 and 12` (= max 19) while you needed `7 + a random number between 1 and 6` so the right code for the number calculation is:

```
var number = 7 + Math.floor(Math.random() * 6);
var number = 13 + Math.floor(Math.random() * 6);
var number = 19 + Math.floor(Math.random() * 6);
var number = 25 + Math.floor(Math.random() * 6);

```

Edit: Not sure if you need a number between 1 and 6 or 1 and 5, sorry about that.
I guess you need this:

```
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() * 6); // i tried from 7 to 12
    $('#my_div2').text(number);
     var number = 13 + Math.floor(Math.random() * 6); // from 13 to 18
    $('#my_div3').text(number);
     var number = 19 + Math.floor(Math.random() * 6); //from 19 to 24
    $('#my_div4').text(number);
     var number = 25 + Math.floor(Math.random() * 6);  // from 25 to 30
    $('#my_div5').text(number);
  },
1000);

```

**updated the fiddle** <http://jsfiddle.net/bxZ9G/8/>