# How to Generate JavaScript Random Numbers?

Today, We want to share with you How to Generate JavaScript Random Numbers?.In this post we will show you How Can I Generate 6 Digits Random Numbers Using JavaScript?, hear for How to Generate Six Digit Unique Random Number Using Javascript? we will give you demo and example for implement.In this post, we will learn about Javascript to generate a 5-digit fixed length random number ??? with an example.

## How to Generate JavaScript Random Numbers?

Contents

There are the Following The simple About Generating random whole numbers in JavaScript in a specific range? Full Information With Example and source code.

As I will cover this Post with live Working example to develop How to Generate a random number of fixed length using JavaScript?, so the javascript number between 2 integers is used for this example is following below.

### JavaScript Random Integers Example

index.html

How Can I Generate 6 Digits Random Numbers Using JavaScript?

```<p id="results"></p>
<script>
var mylivenomber = Math.floor(100000 + Math.random() * 900000);
document.getElementById("results").innerHTML=mylivenomber;
</script>
```

javascript random number between 1 and 10

```<!DOCTYPE html>
<html>
<body>
<p>Click the button to display a random number between 1 and 10.</p>

<button onclick="mylivenomber()">Click It!</button>

<p id="results"></p>

<script>
function mylivenomber() {
var x = Math.floor((Math.random() * 10) + 1);
document.getElementById("results").innerHTML = x;
}
</script>

</body>
</html>
```

From the Mozilla Developer Network documentation:

```var maximum = 50;
var minimum = 10;
var mylivenomber = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
console.log(mylivenomber);
```