# Random number generator

Do you have a raffle and need generate random numbers? Don't worry, with our online tool you can configure the range of numbers to include and get a random number with each press of the button.

If what you need is generate text o secure passwordsPlease do not forget to visit the links we have just provided.

## How the random number generator works Our tool allows you to configure the range of numbers you want to be included. This is especially useful to obtain random numbers between 1 and 10, between 1 and 100 or the amount you want. Just set the minimum value, the maximum value and you're done.

When you have done so, press the calculate button and with each press you will get one random number within the range you have set.

One thing to keep in mind is that our random number generator is with repetitionthat is to say, the same number can appear several times.

Undoubtedly, one of the main uses of this generator will be for organize drawings and select the winner.

## Random numbers for the primitive

You can also use our generator to obtain the numbers of the primitive. To do this you have to configure two intervals, one for the bet and one for the refund:

### Primitiva bets

Each primitive bet is composed of six numbers within the range from 1 to 49.

Configure our tool and press the calculate button as many times as necessary to obtain different numbers randomly, so you can complete a bet or as many as you want.

### Reimbursement

In the case of the refund, you can obtain its value at random setting the range between 0 and 9

## Random numbers in Excel

As it could not be otherwise, we can also generate random numbers in Excel using two methods explained below.

### Random number between 0 and 1

If what you want is to obtain a random number greater than or equal to zero but less than 1then use this function in Excel:

=ALLOCATORIO()

### Random number between two numbers of our choice

If the interval between 0 and one is too short, there is another Excel function that allows us to establish a lower and upper limit that we want. In this case the function is:

=ALATORIO.ENTRE(inferior;superior)

That is, if we want to obtain a random number between 1 and 100, we have to write the function in this form in an empty cell:

=RANDOM.BETWEEN(1;100)

### Non-repeating random number generator in Excel

Generate random numbers without repetition in Excel is a bit more laborious since there is no specific formula to achieve it. One option would be to use macros but we are going to avoid it by doing the following steps with which we are going to generate 10 random numbers between 1 and 20 without repeating them:

1. We generate 20 random numbers with the function =ALEATORIO() 1. Select the range of cells with the 20 numbers generated and assign the name listed by typing it on the left side of the formula bar.
2. Now we place ourselves in a new empty cell and write the following formula

=HIERARCHY(A1;listed)

1. Now copy the above formula into the next 9 cells just below, changing the value of A1 to A2, then to A3 and so on. When we are done, we will have the 10 random numbers between 1 and 20 without repetition.

If we wanted to generate 5 random numbers between 1 and 10, the process would be the same but in the first step we generate only 10 random numbers. So with each particular case but if you have any doubt, leave us a comment and we will help you as soon as possible.

## Random number in JavaScript

JavaScript has a function in the Math library that returns a number between 0 and 1 (not included). It is this:

function random() {
return Math.random();
}

If you want to get a random number between a minimum and a maximum without including itthen you have to write the function like this:

function random(min, max) {
return Math.random() * (max - min) + min;
}

## Random number in PHP

PHP also has a specific function to obtain random numbers between a minimum and a maximum (both included):

int rand ( int \$min , int \$max )

Need to know how to generate a random number in other programming languages like C? Leave us a comment and we will add more examples.