{"id":67151,"date":"2026-10-20T09:51:55","date_gmt":"2026-10-20T06:51:55","guid":{"rendered":"https:\/\/wpcalc.com\/en\/?p=67151"},"modified":"2026-10-20T09:51:55","modified_gmt":"2026-10-20T06:51:55","slug":"random-number-generator","status":"publish","type":"post","link":"https:\/\/wpcalc.com\/en\/statistics\/random-number-generator\/","title":{"rendered":"Random Number Generator"},"content":{"rendered":"<section class=\"not-prose calculator-box\" aria-labelledby=\"calculator-title\"><div class=\"flex items-baseline sm:items-center justify-between gap-2 sm:gap-3\"><div class=\"flex flex-col sm:flex-row sm:items-center gap-2\"><span class=\"icon icon-calculator text-primary-700! text-base! dark:text-primary-300!\" aria-hidden=\"true\"><\/span><h2 id=\"calculator-title\" class=\"text-lg font-display font-bold\">Generate Random Numbers<\/h2><\/div><div class=\"calcdash-favorite group\">\n  <button type=\"button\" class=\"favorite\" id=\"favorite\" data-favorite-id=\"67151\" data-favorite-title=\"Random Number\" data-favorite-url=\"https:\/\/wpcalc.com\/en\/statistics\/random-number-generator\/\" data-favorite-excerpt=\"Generate random integers or fixed-precision decimals within a range. Enter the minimum, maximum, and number of values, then choose whether duplicates are allowed.\" aria-label=\"Add to Favorites\" data-favorite-icon=\"icon icon-wpcalc-dice\">\n    <span class=\"icon icon-shape-star-empty\" aria-hidden=\"true\"><\/span>\n  <\/button>\n  <div class=\"calcdash-favorite__tip\" aria-hidden=\"true\">\n   <span class=\"favorite-tooltip\" id=\"favorite-tooltip\"><\/span>\n  <\/div>\n  <span class=\"sr-only\" role=\"status\" id=\"favorite-status\"><\/span>\n<\/div><\/div><form action=\"https:\/\/wpcalc.com\/en\/statistics\/random-number-generator\/\" method=\"POST\" class=\"calculator\" id=\"calculator-67151\" data-post=\"67151\"><fieldset class=\"fieldset-input is-2\"><legend class=\"sr-only\">Input Fields<\/legend><div class=\"field\" id=\"input-1\"><label for=\"field-1\">Minimum<\/label><input type=\"number\" name=\"minimum\" id=\"field-1\" min=\"-1000000\" max=\"1000000\" step=\"any\" value=\"1\"\/><\/div><div class=\"field\" id=\"input-2\"><label for=\"field-2\">Maximum<\/label><input type=\"number\" name=\"maximum\" id=\"field-2\" min=\"-1000000\" max=\"1000000\" step=\"any\" value=\"100\"\/><\/div><div class=\"field\" id=\"input-3\"><label for=\"field-3\">How many numbers?<\/label><input type=\"text\" name=\"how_many_numbers\" id=\"field-3\" data-number inputmode=\"decimal\" autocomplete=\"off\" spellcheck=\"false\" min=\"1\" max=\"1000\" value=\"1\"\/><\/div><div class=\"field\" id=\"input-4\"><label for=\"field-4\">Allow duplicates?<\/label><div class=\"grid grid-cols-1\"><select id=\"field-4\" name=\"allow_duplicates\"><option value=\"yes\" selected>Yes<\/option><option value=\"no\">No<\/option><\/select><svg class=\"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-gray-500 sm:size-4\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\" data-slot=\"icon\">\n              <path fill-rule=\"evenodd\" d=\"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z\" clip-rule=\"evenodd\" \/>\n            <\/svg><\/div><\/div><div class=\"field\" id=\"input-5\"><label for=\"field-5\">Number type<\/label><div class=\"grid grid-cols-1\"><select id=\"field-5\" name=\"number_type\"><option value=\"integer\" selected>Integers<\/option><option value=\"decimal\">Decimals<\/option><\/select><svg class=\"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-gray-500 sm:size-4\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\" data-slot=\"icon\">\n              <path fill-rule=\"evenodd\" d=\"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z\" clip-rule=\"evenodd\" \/>\n            <\/svg><\/div><\/div><div class=\"field\" id=\"input-6\" hidden><label for=\"field-6\">Decimal places<\/label><div class=\"grid grid-cols-1\"><select id=\"field-6\" name=\"decimal_places\"><option value=\"1\">1<\/option><option value=\"2\" selected>2<\/option><option value=\"3\">3<\/option><option value=\"4\">4<\/option><option value=\"5\">5<\/option><option value=\"6\">6<\/option><option value=\"7\">7<\/option><option value=\"8\">8<\/option><option value=\"9\">9<\/option><option value=\"10\">10<\/option><\/select><svg class=\"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-gray-500 sm:size-4\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\" data-slot=\"icon\">\n              <path fill-rule=\"evenodd\" d=\"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z\" clip-rule=\"evenodd\" \/>\n            <\/svg><\/div><\/div><div class=\"field\" id=\"input-7\"><label for=\"field-7\">Sort results<\/label><div class=\"grid grid-cols-1\"><select id=\"field-7\" name=\"sort_results\"><option value=\"none\" selected>Do not sort<\/option><option value=\"ascending\">Ascending<\/option><option value=\"descending\">Descending<\/option><\/select><svg class=\"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-gray-500 sm:size-4\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\" data-slot=\"icon\">\n              <path fill-rule=\"evenodd\" d=\"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z\" clip-rule=\"evenodd\" \/>\n            <\/svg><\/div><\/div><\/fieldset><div class=\"buttons\"><button type=\"submit\" data-text=\"Re-Calculate\" id=\"calculate-button\" data-post=\"67151\">Calculate<\/button><button type=\"reset\">Reset<\/button><\/div><div class=\"field is-checkbox hidden!\" id=\"field-auto-calc\"><input type=\"checkbox\" id=\"auto-calc\"><label for=\"auto-calc\">Calculate automatically<\/label><small>If enabled, the result will update automatically when you change any value.<\/small><\/div><div class=\"fieldset-result is-hidden\" aria-labelledby=\"result-title\" aria-live=\"polite\" role=\"region\"> <h3 class=\"result-title bg-gradient-to-r from-primary-50 to-gray-50 dark:from-primary-900 dark:to-gray-800\" id=\"result-title\"><span class=\"icon icon-s-pulse\" aria-hidden=\"true\"><\/span> Your Results<\/h3><div class=\"result-box\"><div class=\"field-result is-column\" id=\"output-1\"><span class=\"field-title\"><span>Generated numbers<\/span><\/span><span class=\"field-value\" id=\"result-1\"><\/span><button type=\"button\" class=\"copy-result\" data-tooltip=\"Copy Result\" aria-label=\"Copy Result\"><span class=\"copy-icon icon icon-document-copy\" aria-hidden=\"true\"><\/span><\/button><\/div><\/div><div class=\"result-actions\"><button type=\"button\" class=\"copy-link\"><svg viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M12.232 4.232a2.5 2.5 0 0 1 3.536 3.536l-1.225 1.224a.75.75 0 0 0 1.061 1.06l1.224-1.224a4 4 0 0 0-5.656-5.656l-3 3a4 4 0 0 0 .225 5.865.75.75 0 0 0 .977-1.138 2.5 2.5 0 0 1-.142-3.667l3-3Z\"\/><path d=\"M11.603 7.963a.75.75 0 0 0-.977 1.138 2.5 2.5 0 0 1 .142 3.667l-3 3a2.5 2.5 0 0 1-3.536-3.536l1.225-1.224a.75.75 0 0 0-1.061-1.06l-1.224 1.224a4 4 0 1 0 5.656 5.656l3-3a4 4 0 0 0-.225-5.865Z\"\/><\/svg><span class=\"copy-link__text\">Copy link to this calculation<\/span><\/button><span class=\"sr-only\" role=\"status\" id=\"copy-link-status\"><\/span><\/div><\/div><a href=\"#respond\" class=\"hidden transition-opacity duration-300 opacity-0 w-50 text-sm justify-center items-center gap-2 px-4 py-2 rounded bg-gray-200 text-gray-700 hover:bg-gray-300\" id=\"leave-comment\"><span class=\"icon icon-comments\" aria-hidden=\"true\"><\/span>Leave a Comment<\/a><\/form><\/section><section id=\"calc-reactions\" class=\"not-prose hidden my-12 bg-gradient-to-r from-primary-50 to-gray-50 border border-indigo-100 rounded-xl px-6 py-4 shadow-sm\" data-post=\"67151\" aria-live=\"polite\" aria-labelledby=\"calc-reactions-title\"><p id=\"calc-reactions-title\" class=\"text-sm text-gray-500 text-center mb-2\">How did this result make you feel?<\/p><div role=\"group\" aria-labelledby=\"calc-reactions-title\" class=\"grid grid-cols-3 sm:flex sm:flex-row sm:justify-around gap-4 sm:items-center sm:flex-wrap\"><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"like\"><span class=\"reaction-count\" data-reaction-count=\"like\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude00 <\/span><span class=\"reaction-description font-medium\">Like <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"helpful\"><span class=\"reaction-count\" data-reaction-count=\"helpful\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\udca1 <\/span><span class=\"reaction-description font-medium\">Helpful <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"confused\"><span class=\"reaction-count\" data-reaction-count=\"confused\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude15 <\/span><span class=\"reaction-description font-medium\">Confused <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"disappointed\"><span class=\"reaction-count\" data-reaction-count=\"disappointed\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\ud83d\ude1e <\/span><span class=\"reaction-description font-medium\">Disappointed <\/span><\/button><button type=\"button\" aria-pressed=\"false\" class=\"reaction-btn flex flex-col items-center gap-1 text-sm text-gray-700 hover:text-primary-600 cursor-pointer transition-transform hover:scale-105\" data-reaction=\"inaccurate\"><span class=\"reaction-count\" data-reaction-count=\"inaccurate\">0<\/span><span class=\"reaction text-3xl\" aria-hidden=\"true\">\u274c <\/span><span class=\"reaction-description font-medium\">Inaccurate <\/span><\/button><\/div><div id=\"reaction-message\" class=\"hidden mt-8 rounded-md border border-primary-100 bg-white\/50 backdrop-blur-sm px-4 py-2 text-sm text-center shadow-sm\"><\/div><\/section><div class=\"calcdash-ad not-prose calcdash-ad--calc_result calcdash-ad--in-article\"><ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-1721569815777345\" data-ad-slot=\"6317458308\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\"><\/ins><script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script><\/div>\n<style id=\"wpcoderpro-inline-1\">.formula-box {\r\n\tborder-bottom: none !important;\r\n}<\/style><section class=\"formula-box\" aria-labelledby=\"formula-title\">\r\n\t<div id=\"formula-title\" class=\"not-prose font-display mb-4\"><span class=\"icon icon-formula\" aria-hidden=\"true\"><\/span><h2>Random Number Formula<\/h2><\/div>\r\n\t<figure class=\"not-prose formula\">\r\n\t\t<figcaption class=\"formula-title\">Formula<\/figcaption>\r\n\t\t<div class=\"text-base text-gray-800\" id=\"formula\">\n\\[N=\\lfloor b\\,10^d\\rfloor-\\lceil a\\,10^d\\rceil+1,\\qquad P(X=x)=\\frac{1}{N}\\]\n<\/div>\r\n\t<\/figure>\r\n\t<\/p>\n<p><strong>Where:<\/strong><\/p>\n<ul>\n<li>\\(a\\) \u2014 the minimum entered<\/li>\n<li>\\(b\\) \u2014 the maximum entered<\/li>\n<li>\\(d\\) \u2014 decimal places selected; \\(d=0\\) for integers<\/li>\n<li>\\(N\\) \u2014 the number of eligible values on that precision grid<\/li>\n<li>\\(P(X=x)\\) \u2014 the probability of drawing any one eligible value on a single draw<\/li>\n<\/ul>\n<p>The minimum is rounded up and the maximum down to the selected precision, so generated values stay within both bounds. Each eligible value has the same chance on a single draw.<\/p>\n<p>\r\n<\/section>\n<style id=\"wpcoderpro-inline-459\">.calculation-box {\r\n\tborder-bottom: none !important;\r\n}<\/style><section id=\"calculation\" class=\"calculation-box\" aria-labelledby=\"calculation-title\">\r\n\t<div id=\"calculation-title\" class=\"not-prose font-display\"><span class=\"icon icon-unordered-list\" aria-hidden=\"true\"><\/span><h2>Random Number \u2013 Calculation Example<\/h2><\/div>\r\n\r\n<\/p>\n<p><strong>Example:<\/strong> keep the default settings: Minimum 1, Maximum 100, How many numbers? 1, Allow duplicates? Yes, and Number type Integers. Suppose you want to know the chance of drawing 37.<\/p>\n<p>\\[N=\\lfloor100\\rfloor-\\lceil1\\rceil+1=100,\\qquad P(X=37)=\\frac{1}{100}=1\\%\\]<\/p>\n<p><strong>Result:<\/strong> the generator returns one integer from 1 to 100. The value 37 is one possible result, with a 1% chance on this draw; your actual result will vary.<\/p>\n<p>\n\r\n<\/section>\n<h2>How to use the calculator<\/h2>\n<ol>\n<li>Enter the lower bound in <strong>Minimum<\/strong> and the upper bound in <strong>Maximum<\/strong>. The minimum must not exceed the maximum.<\/li>\n<li>Set <strong>How many numbers?<\/strong> to the number of values you need, from 1 to 1,000.<\/li>\n<li>Choose <strong>Allow duplicates?<\/strong> Select <strong>Yes<\/strong> if a value may appear more than once, or <strong>No<\/strong> if every result must be distinct.<\/li>\n<li>Choose <strong>Number type<\/strong>: <strong>Integers<\/strong> or <strong>Decimals<\/strong>. For decimals, set <strong>Decimal places<\/strong> from 1 to 10. This determines which values can be drawn, not just how they look.<\/li>\n<li>Choose <strong>Sort results<\/strong>: <strong>Do not sort<\/strong>, <strong>Ascending<\/strong>, or <strong>Descending<\/strong>. Read the generated numbers, or use <strong>Generate again<\/strong> for a new draw and <strong>Copy<\/strong> to copy the list.<\/li>\n<\/ol>\n<p>When you request more than one number, the result also shows their sum and mean. These describe the numbers drawn, not every number available in the range. If you change an input after generating a list, run the calculator again to apply the new settings.<\/p>\n<h2>What a random number result means<\/h2>\n<p>This generator selects from a <strong>discrete set of eligible values<\/strong> between your bounds, including either endpoint when it falls on the selected precision grid. With integers from 1 to 100, there are 100 possibilities. With two decimal places from 1 to 2, there are 101 possibilities: 1.00, 1.01, and so on through 2.00. Each eligible value has the same probability on the first draw. For a closer look at equal-probability outcomes, see the <a href=\"https:\/\/wpcalc.com\/en\/statistics\/uniform-distribution-calculator\/\">Uniform Distribution calculator<\/a>.<\/p>\n<p>With <strong>Allow duplicates? Yes<\/strong>, each draw is independent: the same number can appear repeatedly, and an earlier result does not change the chances on the next draw. With <strong>No<\/strong>, values are sampled without replacement. Each eligible value still has the same chance of appearing in any particular draw position, but once selected, it cannot appear again in that list. For example, drawing three distinct integers from 1 to 100 gives any specified integer a \\(3\/100\\) chance of appearing somewhere in the list.<\/p>\n<p>Sorting changes only the displayed order, not which values were drawn. An ascending list can therefore look patterned even though its values were selected randomly. A short random list can also contain clusters, gaps, or repeated values when duplicates are allowed; randomness does not require a visually even spread. If you need to calculate the chance of a particular event rather than generate outcomes, use the <a href=\"https:\/\/wpcalc.com\/en\/statistics\/probability-calculator\/\">Probability calculator<\/a>.<\/p>\n<h2>Limits and practical tips<\/h2>\n<ul>\n<li><strong>Check the available values.<\/strong> Bounds must each be between \u22121,000,000 and 1,000,000. If duplicates are off, the requested count cannot exceed the number of eligible values.<\/li>\n<li><strong>Choose precision deliberately.<\/strong> Decimal results lie on a grid: two places means steps of 0.01, while three places means steps of 0.001. Bounds that fall between grid points are not themselves eligible. A very narrow range may contain no value at the chosen precision.<\/li>\n<li><strong>Keep an unsorted list when draw order matters.<\/strong> Sorting is convenient for checking the range or spotting duplicates, but it removes the original sequence from view.<\/li>\n<li><strong>Record results you need to reproduce.<\/strong> Generate again makes a fresh draw; the calculator does not offer a seed for recreating the same list. Copy the values before leaving the page.<\/li>\n<\/ul>\n<p>The generator uses the browser\u2019s secure random-number facility and avoids favoring some eligible values through a simple remainder calculation. It needs a browser where that facility is available. Randomly generated data can be useful for examples or simulations, but a small sample may differ substantially from the distribution you expect; for a measure of uncertainty across outcomes, see the <a href=\"https:\/\/wpcalc.com\/en\/statistics\/shannon-entropy-calculator\/\">Shannon Entropy calculator<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Generate random integers or fixed-precision decimals within a range. Enter the minimum, maximum, and number of values, then choose whether duplicates are allowed.<\/p>\n","protected":false},"author":3168,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[74],"tags":[76],"class_list":["post-67151","post","type-post","status-publish","format-standard","hentry","category-statistics","tag-probability"],"acf":[],"_links":{"self":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/67151","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/users\/3168"}],"replies":[{"embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/comments?post=67151"}],"version-history":[{"count":1,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/67151\/revisions"}],"predecessor-version":[{"id":67222,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/posts\/67151\/revisions\/67222"}],"wp:attachment":[{"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/media?parent=67151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/categories?post=67151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpcalc.com\/en\/wp-json\/wp\/v2\/tags?post=67151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}