Top "Random" questions

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

Picking a random element from a set

How do I pick a random element from a set? I'm particularly interested in picking a random element from a …

java algorithm language-agnostic random set
Why does this code using random strings print "hello world"?

The following print statement would print "hello world". Could anyone explain this? System.out.println(randomString(-229985452) + " " + randomString(-147909649)); And …

java string random
Random number generator only generating one random number

I have the following function: //Function to get random number public static int RandomNumber(int min, int max) { Random random = …

c# random
generate random double numbers in c++

How to generate random numbers between two doubles in c++ , these numbers should look like xxxxx,yyyyy .

c++ random
How to generate a random string of a fixed length in Go?

I want a random string of characters only (uppercase or lowercase), no numbers, in Go. What is the fastest and …

string random go
Generating random strings with T-SQL

If you wanted to generate a pseudorandom alphanumeric string using T-SQL, how would you do it? How would you exclude …

sql tsql random
Generate unique random numbers between 1 and 100

How can I generate some unique random numbers between 1 and 100 using JavaScript?

javascript random integer numbers
Generate random numbers following a normal distribution in C/C++

How can I easily generate random numbers following a normal distribution in C or C++? I don't want any use …

c++ c random distribution normal-distribution
Generate random numbers with a given (numerical) distribution

I have a file with some probabilities for different values e.g.: 1 0.1 2 0.05 3 0.05 4 0.2 5 0.4 6 0.2 I would like to generate random numbers using …

python module random
Postgres FOR LOOP

I am trying to get 25 random samples of 15,000 IDs from a table. Instead of manually pressing run every time, I'm …

postgresql stored-procedures for-loop random plpgsql