[Question]
  [
The [Pareto Distribution](https://en.wikipedia.org/wiki/Pareto_distribution) is a probability distribution that comes up a lot in nature. It has lots of special properties, such as an infinite mean. In this challenge, you will output a number sampled from this distribution.
The Pareto Distribution is defined to be greater than or equal to `x` with probability `1/x`, for all `x` greater than or equal to 1.
Therefore, a number sampled from this distribution is greater than or equal to 1 with probability 1, greater than or equal to 2 with probability exactly 1/2, greater than or equal to 3 with probability exactly 1/3, greater than or equal to 11.4 with probability exactly 1/11.4, and so on.
Since you will sample this distribution, your program or function will take no input, and output a random number, with the above probabilities. However, if your program doesn't perfectly match the above probabilities due to floating-point impression, that's OK. See the bottom of the challenge for more details.
(This is called the Pareto Distribution with alpha 1 and lower bound 1, to be exact)
Here's 10 example draws from this distribution:
```
1.1540029602790338
52.86156818209856
3.003306506971116
1.4875532217142287
1.3604286212876546
57.5263129600285
1.3139866916055676
20.25125817471419
2.8105749663695208
1.1528212409680156
```
Notice how 5 of them are below 2, and 5 are above 2. Since this is the average result, it could have been higher or lower, of course.
Your answer only needs to be correct up to the limits of your floating point type, real number type, or whatever else you use, but you must be able to represent numbers at at least 3 decimal digits of precision, and represent numbers up to 1,000,000. If you're not sure whether something is OK, feel free to ask.
This is code golf.
---
Details about imprecision:
* For each range `[a, b]`, where `1 <= a < b`, the ideal probability that the sample would fall in that range is `1/a - 1/b`. The probability that your program produces a number in that range must be with `0.001` of `1/a - 1/b`. If `X` is the output of your program, it is required that `|P(a <= X <= b) - (1/a - 1/b)| < 0.001`.
* Note that by applying the above rule with `a=1` and `b` sufficiently large, it is the case that your program must output a number greater than or equal to 1 with at least probability 0.999. The rest of the time it may crash, output `Infinity`, or do whatever else.
I'm fairly certain that the existing submissions of the form `1/1-x` or `1/x`, where `x` is a random float in `[0, 1)` or `(0, 1)` or `[0, 1]`, all satisfy this requirement.
  
[Answer]
# [MATL](https://github.com/lmendo/MATL), 3 bytes
```
1r/
```
[Try it online!](https://tio.run/##y00syfn/37BI//9/AA "MATL – Try It Online") Or [estimate the resulting probabilities](https://tio.run/##y00syflvaAAEVkr/DYv0/8eWGRpY2UXm/gcA) by running it 10000 times.
### Explanation
```
1    % Push 1
r    % Push random number uniformly distributed on the open interval (0,1)
/    % Divide. Implicitly display
```
[Answer]
# [Actually](https://github.com/Mego/Seriously), 4 bytes
```
G1-ì
```
[Try it online!](https://tio.run/##S0wuKU3Myan8/9/dUPfwmv//AQ "Actually – Try It Online")
Explanation:
```
G1-ì
G     random()
 1-   1-random()
   ì  1/(1-random())
```
[Answer]
# R, 10 bytes
```
1/runif(1)
```
Pretty straightforward.
[Answer]
# TI-Basic, 2 bytes
```
rand^-1      (AB 0C in hex)
```
For anyone who is wondering, `rand` returns a random value in (0,1]. "Due to specifics of the random number generating algorithm, the smallest number possible to generate is slightly greater than 0. The largest number possible is actually 1 ..." ([source](http://tibasicdev.wikidot.com/rand)). For example, seeding rand with 196164532 yields 1.
[Answer]
# [R](https://www.r-project.org/), 12 bytes
```
exp(rexp(1))
```
[Try it online!](https://tio.run/##K/r/P7WiQKMIRBhqav7/DwA "R – Try It Online")
[Verify the distribution](https://tio.run/##K/qfZ2toAAJcFTa6/1MrCjSKQESepub/tPwijUyFzDwFQytDA83kxBINpYAijQg7WyWdTB0lTSBVXJqrUWFnm6mpn6ejFJMHFEgtsFVS0vwPAA "R – Try It Online")
This takes a different approach, exploiting [the fact](https://en.wikipedia.org/wiki/Pareto_distribution#Relation_to_the_exponential_distribution) that if `Y~exp(alpha)`, then `X=x_m*e^Y` is a Pareto with parameters `x_m,alpha`. Since both parameters are 1, and the default rate parameter for `rexp` is 1, this results in the appropriate Pareto distribution.
While this answer is a fairly R- specific approach, it's sadly less golfy than [plannapus'](https://codegolf.stackexchange.com/a/150719/67312).
# [R](https://www.r-project.org/), 14 bytes
```
1/rbeta(1,1,1)
```
[Try it online!](https://tio.run/##K/r/31C/KCm1JFHDUAcINf//BwA "R – Try It Online")
Even less golfy, but another way of getting at the answer.
Another property of the exponential distribution is that if `X ~ Exp(λ) then e^−X ~ Beta(λ, 1)`, hence `1/Beta(1,1)` is a `Pareto(1,1)`.
Additionally, a keen observer would recall that if `X ~ Beta(a,b)` and `a=b=1`, then `X~Unif(0,1)`, so this truly is `1/runif(1)`.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 10 bytes
```
Ｉ∕Ｘφ²⊕‽Ｘφ²
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMM5sbhEwyWzLDMlVSMgvzy1SCNNR8FIU0dBW1sjKDEvJT8XWRgMrP///69blgMA "Charcoal – Try It Online")
Link is to the verbose version:
```
Print(Cast(Divide(Power(f, 2), ++(Random(Power(f, 2))))));
```
Comments:
* Charcoal only has methods to get random integer numbers, so in order to get a random floating-point number between 0 and 1 we have to get a random integer between 0 and N and divide by N.
* Previous version of this answer that used the `1/(1-R)` formula: In this case, N is set to 1000000 as the OP asks it to be the minimum. To get this number Charcoal provides a preset variable `f`=1000. So just calculating `f^2` we get 1000000. In the event that the random number is 999999 (the maximum), `1/(1-0.999999)=1000000`.
* Neil's tip (saving 3 bytes): If I have `1/(1-R/N)` where `R` is a random number between 0 and N, it is the same as just calculate `N/(N-R)`. But considering that the random integers `N-R` and `R` have the same probability to occur, that is the same as just calculating `N/R` (being `R` in this last case a number between 1 and N inclusive to avoid division by zero).
[Answer]
# [Haskell](https://www.haskell.org/), ~~61~~ 56 bytes
The function `randomIO :: IO Float` produces random numbers [in the interval](https://stackoverflow.com/a/47831399/2913106) `[0,1)`, so transforming them using `x -> 1/(1-x)` will produce pareto realizations.
```
import System.Random
randomIO>>=print.(1/).((1::Float)-)
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/PzO3IL@oRCG4srgkNVcvKDEvJT@XKzcxM8@2CMz29Lezsy0oyswr0dMw1NfU09AwtLJyy8lPLNHU1fz/HwA "Haskell – Try It Online")
[Answer]
# Excel, 9 bytes
```
=1/rand()
```
Yay, Excel is (semi-)competitive for a change!
[Answer]
# Mathematica, 10 bytes
```
1/Random[]
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b731A/KDEvJT83OvZ/QFFmXolD2n8A "Wolfram Language (Mathematica) – Try It Online")
-4 bytes from M.Stern
[Answer]
# Ruby, ~~14~~ 8 bytes
```
p 1/rand
```
Trivial program, I don't think it can get any shorter.
[Answer]
# Excel VBA, 6 Bytes
Anonymous VBE immediate window function that takes no input and outputs to the VBE immediate window
```
?1/Rnd
```
[Answer]
# [Python](https://python.org), 41 bytes
```
lambda:1/(1-random())
from random import*
```
[Try it online!](https://tio.run/##JYtBCoMwEADvvmKPu4WioTfBl7QiKUnagMmGNQp9fbricYaZ8qtfzo8WpldbbXo7O5oezV1sdpyQqAvCCS6EmApLvbXDrrvfYIJN0Tt8BiQILLBAzGf88WiGgWbd1Wp@@usaO4AiMVdUpvYH "Python 3 – Try It Online")
---
Using the builtin is actually longer:
# [Python](https://python.org), 43 bytes
```
lambda:paretovariate(1)
from random import*
```
[Try it online!](https://tio.run/##JYtBCoQwDEX3niLL1pXiTvAkOgwZ2mrBNiVGYU5fI64@7/Ne@ctGeahhWuqO6edwLMhe6EKOKN70tglMCRiz04mpEEtbL9xPf8AEh6J3Zg7GQiCGL8T8yKumXWc/muur@vO/1dgAFI5ZjLKtNw "Python 3 – Try It Online")
Both solutions work in both Python 2 and Python 3.
[Answer]
# [J](http://jsoftware.com/), 5 bytes
```
%-.?0
```
## How ot works:
`?0` generates a random value greater than 0 and less than 1
`-.` subtract from 1
`%` reciprocal 
[Try it online!](https://tio.run/##y/qfbmulYKAAxP9VdfXsDf5rcinpKain2eqpK@go1FoppHNxpSZn5CukQSh1dSgdklpcolCeWZKhYGigUJaYU5paDJXS0QOZZGigbPAfAA "J – Try It Online")
[Answer]
# [Red](http://www.red-lang.org), 19 bytes
```
1 /(1 - random 1.0)
```
[Try it online!](https://tio.run/##K0pN@R@UmqIQHatQUJSZV/LfUEFfw1BBV6EoMS8lP1fBUM9A8z9YRkFJSaEotSA1sUQhT8HQQCEaIopFfex/AA "Red – Try It Online")
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 5 bytes
```
÷1-?0
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT////1Hf1EdtEw5vN9S1N/j/HwA "APL (Dyalog Unicode) – Try It Online")
**How?**
```
 ÷   1-     ?0
1÷  (1-  random 0..1)
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt/), 6 bytes
`1/1-Mr` is the same length but this felt a little less boring!
```
°T/aMr
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.5&code=sFQvYU1y&input=)
---
## Explanation
Increment (`°`) zero (`T`) and divide by (`/`) its absolute difference (`a`) with `Math.random()`.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
Jelly also doesn't have random float, so this uses `x/n` where `x` is an random integer in range `[1, n]` (inclusive) to emulate a random float in range `(0, 1]`. In this program `n` is set to be `108`.
```
ȷ8µ÷X
```
[Try it online!](https://tio.run/##ASEA3v9qZWxsef//yLc4wrXDt1j/4bmbwqIk4oG0w5DCoeG4iv8 "Jelly – Try It Online")
## Explanation
```
ȷ8     Literal 10^8.
  µ    New monad.
   ÷   Divide by
    X  random integer.
```
---
# [Enlist](https://github.com/alexander-liao/enlist), 3 bytes
```
ØXİ
```
[Try it online!](https://tio.run/##S83LySwu@f//8IyIIxv@/wcA "Enlist – Try It Online")
Enlist beats Jelly! (TI-Basic not yet)
## Explanation
```
  İ    The inverse of...
ØX     a random float in [0, 1)
```
Of course this has nonzero probability of take the inverse of 0.
[Answer]
# IBM/Lotus Notes Formula, 13 bytes
```
1/(1-@Random)
```
**Sample (10 runs)**
[![enter image description here](https://i.stack.imgur.com/Ad3kt.png)](https://i.stack.imgur.com/Ad3kt.png)
[Answer]
# Java 8, ~~22~~ 18 bytes
```
v->1/Math.random()
```
(Old answer before the rules changed: `v->1/(1-Math.random())`)
[Try it here.](https://tio.run/##LY7LbsJADEX3fMVdzgiRxzrQLwA2kbqpWLiTgQ5MPFHGiYQqvj01Bcm2ZOvoXF9ppk0aPF@72@Ii5YwDBf5dAYHFj2dyHsfnCnRp@o4eznym0GG2jV4f2lpZSILDEYwdlnnzUZcHkp9iJO5Sb@zSvLhBDcq98fnp6TXOtDIGvnydyL6izmk0mo@wq5qwrXWs1xZliX1KA@oKEnqf/1GgvWfxfZEmKQbVSGTDhTM8xWjfTz6WPw)
[Answer]
# JavaScript REPL, 15 ~~19~~ bytes
```
1/Math.random()
```
[Answer]
# [Pyt](https://github.com/mudkip201/pyt), 2 bytes
```
ṛ⅟
```
Explanation:
```
ṛ           Random number in [0,1)
 ⅟          Multiplicative inverse
            Implicit print
```
[Try it online!](https://tio.run/##K6gs@f//4c7Zj1rn//8PAA)
[Answer]
# J, 9 Bytes
```
p=:%@?@0:
```
I couldn't figure out how to make it take no input, since p=:%?0 would evaluate immediately and remain fixed. Because of this its sort of long.
### How it works:
```
p=:        | Define the verb p
       0:  | Constant function. Returns 0 regardless of input.
     ?@    | When applied to 0, returns a random float in the range (0,1)
   %@      | Reciprocal
```
Evaluated 20 times:
```
    p"0 i.20
1.27056 1.86233 1.05387 16.8991 5.77882 3.42535 12.8681 17.4852 2.09133 1.82233 2.28139 1.58133 1.79701 1.09794 1.18695 1.07028 3.38721 2.88339 2.06632 2.0793
```
[Answer]
# [Pyth](https://pythreadthedocs.io), 4 bytes
```
c1O0
```
[Try it here!](https://pyth.herokuapp.com/?code=c1O0&debug=0)
Alternative: `c1h_O0`.
[Answer]
# [Clean](https://clean.cs.ru.nl), 91 bytes
```
import StdEnv,Math.Random,System.Time
Start w=1.0/(1.0-hd(genRandReal(toInt(fst(time w)))))
```
Clean doesn't like random numbers.
Because the random generator (a Mersenne Twister) *needs* to be given a seed, I have to take the system timestamp to get something that differs passively per-run, and to do anything IO-related I *need* to use a whole `Start` declaration because it's the only place to obtain a `World`.
[Try it online!](https://tio.run/##JcpBCsIwEIXhvafIMkIb9QDudFFQkMYLDE3SBjITaUZLL@@Y4lv88OAbkgcSzO6dvEKIJBFfeWZl2V3p09yBJ9MDuYyNXQt7NM@IfmcZKlrOJ3M86Jp2cnr0tMneQ9KcO2IdCmuuXC37bSLfISQYi7TdTS4rAcbhfx4JOOQZfw "Clean – Try It Online")
]