Top "Random" questions

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

Getting a random value from a JavaScript array

Consider: var myArray = ['January', 'February', 'March']; How can I select a random value from this array using JavaScript?

javascript random
How to generate a random number in C++?

I'm trying to make a game with dice, and I need to have random numbers in it (to simulate the …

c++ random
MySQL select 10 random rows from 600K rows fast

How can I best write a query that selects 10 rows randomly from a total of 600k?

mysql sql random
How to request a random row in SQL?

How can I request a random row (or as close to truly random as is possible) in pure SQL?

sql random
Sample random rows in dataframe

I am struggling to find the appropriate function that would return a specified number of rows picked up randomly without …

r dataframe random r-faq
Generating random numbers in Objective-C

I'm a Java head mainly, and I want a way to generate a pseudo-random number between 0 and 74. In Java I …

objective-c random
Random shuffling of an array

I need to randomly shuffle the following Array: int[] solutionArray = {1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1}; Is there any function to do that?

java arrays random shuffle
How to generate a random string in Ruby

I'm currently generating an 8-character pseudo-random uppercase string for "A" .. "Z": value = ""; 8.times{value << (65 + rand(25)).chr} but it …

ruby random passwords
Random float number generation

How do I generate random floats in C++? I thought I could take the integer rand and divide it by …

c++ random floating-point