Tag: random

57 votes
21 answers
596 views
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 a uni

avatar
Wilber
0 1 0 9
asked 07 September, 2021
61 votes
28 answers
1.6K views
Understanding "randomness"

I can't get my head around this, which is more random? rand() OR: rand() * rand() I´m finding it a

avatar
Thurman
0 1 0 9
asked 07 September, 2021
62 votes
11 answers
3.1K views
Sample random rows in dataframe

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

avatar
Luis
0 1 0 9
asked 07 September, 2021
62 votes
16 answers
1.9K views
Better way to shuffle two numpy arrays in unison

I have two numpy arrays of different shapes, but with the same length (leading dimension). I want to shuffle e

avatar
Wilfredo
0 1 0 9
asked 07 September, 2021
54 votes
25 answers
2.9K views
How does one generate a random number in Apple's Swift language?

I realize the Swift book provided an implementation of a random number generator. Is the best practice to cop

avatar
Adolfo
0 1 0 9
asked 07 September, 2021
54 votes
28 answers
996 views
Random record from MongoDB

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

avatar
Karolyn
0 1 0 9
asked 07 September, 2021
54 votes
15 answers
2.8K views
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(random

avatar
Carmelina
0 1 0 9
asked 07 September, 2021
63 votes
30 answers
2.2K views
How to generate a random alpha-numeric string

I've been looking for a simple Java algorithm to generate a pseudo-random alpha-numeric string. In my si

avatar
Arline
0 1 0 9
asked 07 September, 2021
55 votes
30 answers
2.2K views
How do I generate random integers within a specific range in Java?

How do I generate a random int value in a specific range? I have tried the following, but those do not work: A

avatar
Patsy
0 1 0 9
asked 07 September, 2021
52 votes
30 answers
581 views
PHP random string generator

I'm trying to create a randomized string in PHP, and I get absolutely no output with this: <?php

avatar
Janella
0 1 0 9
asked 07 September, 2021