Top "Random" questions

This tag is for questions pertaining to random numbers and their generators, whether pseudo-random or truly random.

How to generate random number with the specific length in python

Let say I need a 3 digit number, so it would be something like: >>> random(3) 563 or >>&…

python random
How to get random value out of an array?

I have an array called $ran = array(1,2,3,4); I need to get a random value out of this array and store …

php arrays random
Pick a random value from an enum?

If I have an enum like this: public enum Letter { A, B, C, //... } What is the best way to pick …

java random enums
Create an array with random values

How can I create an array with 40 elements, with random values from 0 to 39 ? Like [4, 23, 7, 39, 19, 0, 9, 14, ...] I tried using solutions from here: …

javascript arrays random
Best way to randomize an array with .NET

What is the best way to randomize an array of strings with .NET? My array contains about 500 strings and I'd …

c# .net algorithm sorting random
How can I generate a random number in a certain range?

How can I create an app that generates a random number in Android using Eclipse and then show the result …

android random numbers range generator
Java: random long number in 0 <= x < n range

Random class has a method to generate random int in a given range. For example: Random r = new Random(); int …

java random range long-integer
Generate a random point within a circle (uniformly)

I need to generate a uniformly random point within a circle of radius R. I realize that by just picking …

math random geometry probability
Random record from MongoDB

I am looking to get a random record from a huge (100 million record) mongodb. What is the fastest and most …

mongodb random mongodb-query
How to deal with a slow SecureRandom generator?

If you want a cryptographically strong random numbers in Java, you use SecureRandom. Unfortunately, SecureRandom can be very slow. If …

java performance security random entropy