Trying to think of a number but just can’t come up with anything? Demonstrating probability for a classroom? Need to pull a random number from a hat for a raffle? You’ve come to the right place! Our random number generator will give you just that—a random number. A random number is a number chosen by chance from a set range. The
beauty of random numbers is that you can’t predict what number you’ll get. Even if you choose 2 the first time, 4 the second, and 6 the third, any perceived pattern is totally random! The fourth time you choose it could be 19 or 100. It’s all up to chance. Our generator will provide a random number between the two numbers of your choice. Just enter a lower limit number and an upper limit number and click ENTER. Your random number will be generated and appear in the
box. Now, if you're trying to come up with a list of random numbers yourself, you probably will find a pattern. Even subconsciously, the human mind is conditioned to look for and create things in a pattern or sequence. Unfortunately, this could negatively impact math problems you're working on or activities you have planned. To make sure it stays up to chance and that you don’t have any influence over
this choice, we’ve created this handy random number generator that can select a number for you. It’s simple to use. Just put in two numbers and the random number generator will give you an integer in between them. The random number generator recognizes whole numbers and negative numbers. It does not recognize decimals, fractions, or equations. If you insert a percent symbol, the symbol will not carry over into the random number
box. Let's say you need to pull a random number for a raffle
prize. There are thirty people who enter the raffle, and only three people will win. The tickets range from 1 to 150, so the Lower Limit is 1 and the Upper Limit would be 150. Click Enter and the random number generator gives you a 7, 36, and 2. Raffle participants with the numbers 7, 36, and 2 on their tickets will be the three raffle winners. Decimal TroubleImagine you are trying to find a number between 2.01 and 2.5. You enter 2.01 as your Lower Limit and 2.5 as your Upper Limit. You click Enter, and you get—a 2? That’s not between your values! Sorry, there are no decimals allowed in this random number generator. However, as long as you're working within decimals of the same whole number, you could use other whole numbers as your two values, and assign the result after the decimal. So if your range is between 2.01 and 2.5, you could enter 1 and 50 in the value boxes. Let's say it generates the number 25. You could assign that after your decimal, and this would be your result: 2.25 Are you trying to calculate a problem or convert other numbers between units? Check out our Other Calculators! Sign Up For Our FREE Newsletter!Sign Up For Our FREE Newsletter!I think I have four answers, two giving exact solutions like that of @Adam Rosenfield but without the infinite loop problem, and other two with almost perfect solution but faster implementation than first one. The best exact solution requires 7 calls to Method 1 - ExactStrength of Adam's answer is that it gives a perfect uniform distribution, and there is very high probability (21/25) that only two calls to rand5() will be needed. However, worst case is infinite loop. The first solution below also gives a perfect uniform distribution, but requires a total of 42 calls to Here is an R implementation:
For people not familiar with R, here is a simplified version:
The distribution of Here are all the possible combinations:
I think it's straight forward to show that Adam's method will run much much faster. The probability that there are 42 or more calls to Method 2 - Not ExactNow the second method, which is almost uniform, but requires 6 calls to
Here is a simplified version:
This is essentially one iteration of method 1. If we generate all possible combinations, here is resulting counts:
One number will appear once more in Now, in Method 1, by adding 1 to 6, we move the number 2233 to each of the successive point. Thus the total number of combinations will match up. This works because 5^6 %% 7 = 1, and then we do 7 appropriate variations, so (7 * 5^6 %% 7 = 0). Method 3 - ExactIf the argument of method 1 and 2 is understood, method 3 follows, and requires only 7 calls to Here is an R implementation:
For people not familiar with R, here is a simplified version:
The distribution of Here are all the possible combinations:
I think it's straight forward to show that Adam's method will still run faster. The probability that there are 7 or more calls to Method 4 - Not ExactThis is a minor variation of the the second method. It is almost uniform, but requires 7 calls to
Here is a simplified version:
If we generate all possible combinations, here is resulting counts:
Two numbers will appear once less in What's a number between 1 and 2?What are the five rational numbers between 1 and 2? Answer: The five rational numbers between 1 and 2 are 11/10, 12/10, 13/10, 14/10 and 15/10.
What is a number between 1 and 100?The whole number between 1 and 100 are 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74 ...
How do you pick a raffle number?Choose your numbers based on the frequency chart.. Select numbers that are drawn frequently. If you notice that a few numbers stand out for being drawn significantly more often than the others, consider including them in your pick. ... . Select numbers that are drawn less frequently.. What is number picker?NumberPicker is a custom widget designed for choosing an integer or decimal number by scrolling spinners.
|