How to choose a random number. Excel Random Number Generator in Functions and Data Analysis

etc., and is used by account holders to attract new audience to the community.

The result of such draws often depends on the luck of the user, since the recipient of the prize is determined randomly.

For such a definition, draw organizers almost always use a generator random numbers online or pre-installed, distributed free of charge.

Choice

Quite often, it can be difficult to choose such a generator, since their functionality is quite different - for some it is significantly limited, for others it is quite wide.

Implemented enough a large number of such services, but the difficulty is that they differ in scope.

Many, for example, are tied with their functionality to a specific social network (for example, many generator applications only work with links of this one).

The simplest generators simply generate a random number within a given range.

This is convenient because it does not associate the result with a specific post, which means that they can be used for draws outside the social network and in various other situations.

They don't really have any other use.

Advice! When choosing the most suitable generator, it is important to consider the purpose for which it will be used.

Specifications

For the fastest process of choosing the optimal online random number generation service, the table below shows the main specifications and functionality of such applications.

Table 1. Features of the functioning of online applications for generating a random number
Name Social network Multiple results Select from a list of numbers Online Widget for Website Select from a range Turn off repetitions
randstuff Yes Yes No Yes No
Cast Lots Official site or VKontakte No No Yes Yes Yes
Random number Official site No No No Yes Yes
Randomus Official site Yes No No Yes No
random numbers Official site Yes No No No No

All applications discussed in the table are described in more detail below.

randstuff

You can use this application online using the link to its official website http://randstuff.ru/number/.

This is a simple random number generator, characterized by fast and stable operation.

It is successfully implemented both in the format of a separate independent application on the official website, and as an application in .

Peculiarity this service in that he can choose a random number both from the specified range and from a specific list of numbers that can be specified on the site.

  • stable and fast work;
  • Lack of direct link to the social network;
  • You can select one or more numbers;
  • You can only choose from the given numbers.

User reviews about this application are as follows: “We determine the winners in VKontakte groups through this service. Thank you”, “You are the best”, “I use only this service”.

Cast Lots

This application is a simple function generator, implemented on the official website, in the form of a VKontakte application.

There is also a generator widget to embed on your site.

The main difference from the previous described application is that this allows you to disable the repetition of the result.

The presented online random number generator works on the basis of a software generator built into JavaScript pseudo-random numbers with an even distribution. Integers are generated. By default, 10 random numbers are displayed in the range 100...999, the numbers are separated by spaces.

Basic settings of the random number generator:

  • Amount of numbers
  • Number range
  • Separator type
  • On / off the function of removing repetitions (doubles of numbers)

The total number is formally limited to 1000, the maximum number is 1 billion. Separator options: space, comma, semicolon.

Now you know exactly where and how to get a free sequence of random numbers in a given range on the Internet.

Random Number Generator Use Cases

Random number generator (RNG on JS with uniform distribution) will be useful for SMM-specialists and owners of groups and communities in in social networks Instagram, Facebook, Vkontakte, Odnoklassniki to determine the winners of lotteries, contests and prize draws.

The random number generator allows you to draw prizes among an arbitrary number of participants with a given number of winners. Contests can be held without reposts and comments - you yourself set the number of participants and the interval for generating random numbers. You can get a set of random numbers online and for free on this site, and you do not need to install any application on your smartphone or program on your computer.

Also, an online random number generator can be used to simulate a coin toss or dice. But by the way, we have separate specialized services for these cases.

We have a sequence of numbers, consisting of almost independent elements that obey a given distribution. Usually evenly distributed.

You can generate random numbers in Excel in different ways and ways. Let's take a look at the best of them.

Random Number Function in Excel

  1. The RAND function returns a random uniformly distributed real number. It will be less than 1, greater than or equal to 0.
  2. The RANDBETWEEN function returns a random integer.

Let's look at their use with examples.

Selecting random numbers with RAND

This function does not require any arguments (RAND()).

To generate a random real number between 1 and 5, for example, use the following formula:=RAND()*(5-1)+1.

The returned random number is evenly distributed over the interval .

Each time the worksheet is calculated, or the value in any cell in the worksheet changes, a new random number is returned. If you want to save the generated population, you can replace the formula with its value.

  1. We click on a cell with a random number.
  2. Highlight the formula in the formula bar.
  3. Press F9. AND ENTER.

Let's check the uniformity of the distribution of random numbers from the first sample using the distribution histogram.


The range of vertical values ​​is frequency. Horizontal - "pockets".



RANDBETWEEN function

The syntax of the RANDBETWEEN function is (lower bound; upper bound). The first argument must be less than the second. IN otherwise the function will throw an error. The bounds are assumed to be integers. The formula discards the fractional part.

An example of using the function:

Random numbers with 0.1 and 0.01 precision:

How to make a random number generator in Excel

Let's make a random number generator with the generation of a value from a certain range. We use a formula like: =INDEX(A1:A10;INTEGER(RAND()*10)+1).

Let's make a random number generator in the range from 0 to 100 with a step of 10.

From the list of text values, you need to select 2 random ones. Using the RAND function, we compare text values ​​in the range A1:A7 with random numbers.

Let's use the INDEX function to select two random text values ​​from the original list.

To select one random value from the list, apply the following formula: =INDEX(A1:A7,RANDBETWEEN(1,COUNT(A1:A7))).

Normal Distribution Random Number Generator

The functions RAND and RANDBETWEEN produce random numbers with a single distribution. Any value with the same probability can fall into the lower limit of the requested range and into the upper one. It turns out a huge spread from the target value.

Normal distribution means that most of the generated numbers are close to the target. Let's correct the RANDBETWEEN formula and create a data array with a normal distribution.

The cost of goods X is 100 rubles. The entire batch produced is subject to a normal distribution. The random variable also follows a normal probability distribution.

Under such conditions, the average value of the range is 100 rubles. Let's generate an array and build a graph with a normal distribution with a standard deviation of 1.5 rubles.

We use the function: =NORMINV(RAND();100;1.5).

Excel calculated which values ​​are in the range of probabilities. Since the probability of producing a product with a cost of 100 rubles is maximum, the formula shows values ​​​​close to 100 more often than the rest.

Let's move on to plotting. First you need to create a table with categories. To do this, we divide the array into periods:

Based on the data obtained, we can form a diagram with a normal distribution. The value axis is the number of variables in the interval, the category axis is the periods.

What is randomness in a computer? How is random number generation done? In this article, we have tried to give simple answers to these questions.

IN software, and in technology in general, there is a need for reproducible randomness: numbers and pictures that seem random are actually generated by a certain algorithm. This is called pseudo-randomness, and we will consider simple ways generating pseudo-random numbers. At the end of the article, we formulate a simple theorem for generating these seemingly random numbers.

Determining what exactly is randomness can be quite a challenge. There are tests (Kolmogorov complexity, for example) that can give you an accurate measure of how random a given sequence is. But we will not bother, but simply try to create a sequence of numbers that will seem unrelated to each other.

Often, not just one number is required, but several random numbers generated continuously. Hence, given the initial value, we need to generate other random numbers. This initial value is called seed, and later we will see how to get it. For now, let's concentrate on generating other random values.

Generating random numbers from a seed

One approach might be to apply some crazy math formula to the seed, then twist it so much that the output number seems unpredictable, and then take that as the seed for the next iteration. The only question is what this distortion function should look like.

Let's experiment with this idea and see where it takes us.

The distortion function will take one value and return another. Let's call it R.

R(Input) -> Output

If the value of our seed is 1, then R will create a series of 1, 2, 3, 4, ... Looks not at all random, but we'll get to that. Now let R add a constant instead of 1.

R(x) = x + c

If c equals, for example, 7, then we get a series of 1, 8, 15, 22, ... Still not right. Obviously, what we are missing is that the numbers should not only increase, they should be scattered over some range. We want our sequence to go back to the beginning - a circle of numbers!

number circle

Let's look at the clock face: our series starts at 1 and goes around to 12. But since we are working with a computer, let's put 0 instead of 12.

Now, starting from 1, we will add 7 again. Progress! We see that after 12 our series begins to repeat, no matter what number we start from.

Here we get a very important property: if our cycle consists of n elements, then the maximum number of elements that we can get before they begin to repeat is n.

Now let's rewrite the R function to fit our logic. You can limit the length of the loop using the modulus operator or the modulo operator.

R(x) = (x + c) % m

R (x) = (x + c)% m

At this point, you may notice that some numbers are not suitable for c. If c = 4, and we started with 1, our sequence would be 1, 5, 9, 1, 5, 9, 1, 5, 9, … which of course doesn't suit us, because this sequence is absolutely not random. It becomes clear that the numbers we choose for the length of the cycle and the length of the jump must be related in a special way.

If you try a few different values, you can see one property: m and c must be coprime.

So far we've been jumping by adding, but what if we use multiplication? Let's multiply X to a constant a.

R(x) = (ax + c) % m

R (x) = (ax + c)% m

Properties that a must obey in order to form full cycle, are a little more specific. To create a valid loop:

  1. (a - 1) must be divisible by all prime factors m
  2. (a - 1) must be divisible by 4 if m is divisible by 4

These properties, together with the rule that m and c must be coprime, constitute the Hull-Dobell theorem. We won't go into the proof of it, but if you took a bunch of different values ​​for different constants, you could come to the same conclusion.

Seed selection

It's time to talk about the most interesting part: the choice of the initial seed. We could make it a constant. This can be useful when you need random numbers, but you want them to be the same every time you run the program. For example, creating the same map for every game.

Another way is to get a seed from a new source each time the program is started, just like in the system clock. This is useful when you need a total random number, like in a dice rolling program.

Final result

When we apply a function to its result multiple times, we get a recurrence relation. Let's write our formula using recursion.

Today, random number generators are actively used in the most different areas human activity. However special popularity they purchased at, which suit the owners of online stores, beauty salons, cafes and other establishments for a draw advantageous offers, bonuses and gifts among their subscribers. It is the random number generator that works for free online that allows you to honestly choose the winner.

If we are talking about the one-time use of the generator, you can use the simplest option such a program:

However, the computing power and functionality of such a service is not always sufficient to obtain the necessary data. Today, there are quite a number of specialized online programs, which differ not only in the simplicity of the interface for the user, but also in their wide functionality. You do not have to search for dozens of programs on your own, because especially for you, in this article, we have prepared detailed overview TOP 3 best online number generators according to users:

First you need to get acquainted with the main criteria:

  1. Select from a list. The ability to provide the user with their own list for generation, followed by the selection of a random number from a given set.
  2. Select from a range. Generator Ability random numbers online for free to sample from a specific range.
  3. Outputting multiple numbers. A function responsible for simultaneously providing several random numbers at once, if the user needs to receive more than one value.
  4. Disabling recurrence. The ability of the generator to exclude from subsequent generations the number that fell before it, so that when receiving several random numbers in a row, they are not duplicated.
  5. Website Widget. The ability to connect the generator to your website or social media page so that it is always at hand and available for work.
  6. Link to result. The possibility of obtaining a separate link to the result of each individual generation, which confirms the accuracy of the information provided when providing the results of contests or draws.

Before you prepare this article we analyzed many generators that are on the Internet. And out of all - chose the 3 best:

TOP-1: number generator "Randstaff"


Description: The undisputed leader of our ranking best generators random numbers is a Randstaff service. It boasts a user-friendly user interface, made in gray color, which does not put pressure on the eyes at all. It is convenient to use not only on a computer, but also with the help of mobile phone, which is especially true if you need to generate a random number without access to a PC.

Advantages: This free online random number generator has extensive functionality and offers the user the ability to generate any number of random numbers from a list or range without repetition. You can choose the most convenient option for using the Randstaff service yourself through a special widget, an application on social networks or the official website. After completing a simple registration procedure, you will get access to your personal account, where all your results will be securely stored.

Flaws: Not possible. And you can save the result of the generation only for 3 days (but this is usually enough). If you want to save the result forever - you need to register in personal account(cost - 300 rubles).

TOP 2: Castlelot Number Generator


Description: The second place rightfully belongs to the Castlelot random number generator. It is not an independent service, but part of a portal with a variety of useful things that generate beautiful rhymes, unique logins and simply store collections of interesting films or quotes. The interface differs little from similar services, but boasts wider functionality.

Advantages: Castlelot allows the user to select random numbers from a given range. It can be one or more digits. You can choose the mode of operation of the service with or without repetition. A handy advantage of the Castlelot generator is the ability to get a separate link to each result. Has an exclusive feature called "Even More Randomness". When activated, the generation process does not start until the user moves the mouse cursor to a certain position. In addition, the range of additional service tools includes a widget for the site and a proprietary VKontakte application.

Flaws: The only obvious disadvantage of such a generator is the lack of the ability to select from a list.

TOP 3: generator "Random number.rf"


Description: The "Random number" service allows you to generate online values in the range from 1 to 99999. The design is minimalistic, which is good for it. No distractions. They are equally convenient to use on a computer or smartphone. Large black numbers on a white background are clearly visible, so even people with vision problems will not experience discomfort during its use.

Advantages: The functionality of such an online random number generator allows you to select a random value from a list and a specific range. If you need to get several random numbers online at once, the required number should be indicated in the appropriate field, where the default value is 1. The repetition is disabled at the user's request.

Flaws: You will not be able to connect such a service to your website or community in social networks, since such a random number generator does not have its own widget. There are no links to the result either, which, together with other shortcomings, brings this service to the last place in our rating.

Conclusion

In our opinion, the best and optimal service for generating a random number is . It has all the features that other generators have. Its only disadvantage is the inability to disable the repetition of numbers during generation. But as we wrote above, this nuance is not very important for the average user. Maybe we missed something in this article? If so, write in the comments!