Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I get non-repeating random numbers from Mathematica 8?

How can I know which distribution the numbers I get are?

Can I choose the distribution I want together with the non-repeating random numbers?

How to write the expressions or formulas of permutation and combination?

Are these numbers real random numbers, not pseudo-random numbers?

share|improve this question
Sorry, the "random" numbers in Mathematica are always pseudorandom. If you're fine with that, look into RandomReal[] and RandomVariate[]. – J. M. May 15 '12 at 6:31
Most of your questions (for Mathematica) can be answered if you take a look into the help. 1. Use RandomReal[] or RandomInteger[] or RandomComplex[] without SeedRandom[]. 2. The numbers of RandomReal[] etc. are uniformly distributed over the range you have chosen. 3. Should be possible, take a look at RandomVariate[]. 4. That is something I do not know well, but I think the documentation can help again. 5. They are pseudorandom numbers. – partial81 May 15 '12 at 6:35
For 4: permutations are represented by FactorialPower[]; combinations are represented by Binomial[]. – J. M. May 15 '12 at 7:58
Given the finite number of numbers that can be given with any given fixed amount of precision it is impossible to get an infinite amount non-repeating random numbers. For instance, RandomInteger[9], can only generate 10 different numbers and if we have drawn them all the party is over. So, could you be a bit more explicit about this non-repeating requirement of yours? – Sjoerd C. de Vries May 15 '12 at 9:56
@SjoerdC.deVries: For a random drawing without repetition with the number of drawings equal the number of available items, I'd expect to get a random permutation of the items. Is there any other possible interpretation? – celtschk May 15 '12 at 10:57

You can obtain discrete uniform or normally distributed numbers from, which allows you to generate 200k bits/day.

Import["", "Binary"]
share|improve this answer
That looks like a handy import statement, what format and range do you get ? – image_doctor May 15 '12 at 9:05
It looks to be a uniform distribution between 0 and 255. The format is just a list of 1024 integers. – jVincent May 15 '12 at 9:27
@jVincent What result did you get? Executing the Import I got a list of 83 integers between 32 and 121. Executing it again .. I got exactly the same list of 83 numbers, which look suspiciously ASCII in range. Further investigation reveals that the bytes translate to ..."You have used your quota of random bits for today. See the quota page for details." Mystery solved :) – image_doctor May 15 '12 at 10:05
Actually, that's a terrible interface for reporting exhausted quota when asking for binary data because it means if you are not careful, your code will silently use non-random values. Instead they should have used an HTTP error (maybe 412 Precondition Failed; if you can extend your quota by paying — I didn't check that — also 402 Payment Required might be reasonable). – celtschk May 16 '12 at 7:41
OK, I now looked at the documentation of the site, and according to their documentation, they indeed do return an error status code (503). That means, the problem is with Mathematica, for ignoring the error. – celtschk May 16 '12 at 7:56

If you need high quality non-pseudo random numbers one solution is to use hardware based devices.

One such device can be found here: Quantum Random Number Generator

It's application with Mathematica can be found here: Mathematica QRNG

Available parametric distributions in Mathematica can be found here: MMA Distributions

share|improve this answer

You can use RandomSample to ensure non-repeating random selection. The example below produces a flat distribution of unique values which you could reduce to the distribution you require. Accuracy is increased by sampling from a larger initial population.

a = RandomSample[Union[RandomInteger[10^7, 10^6]], 10^4];
If[Union[a] == Sort[a], "No repeated values", "Repeated values"]

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.