Questions tagged [random]

-4 votes
1 replies
Is there a way to make randint() less pseudo and more random? [closed]
I'm working on a lottery simulator and I'm not quiet happy with the draws generated by randint. Are there any tricks to make it more random?...
asked 1 month ago
-1 votes
0 replies
Generating two random numbers or selecting two random spots from an array [duplicate]
I'm trying to make a game with dice, and I need to have random numbers in it (to simulate the sides of the die. I know how to make it between 1...
asked 1 month ago
0 votes
1 replies
Prefab enemy all walk in same random path
I have a script on an enemy that walks randomly inside a square. I get a random point from that square and moves the enemy towards that random ge...
asked 1 month ago
2 votes
0 replies
Random variable value from list
I'm trying to build a simple script which randomises data. I will make it very simple. Let's say I have the following data inside data.txt: 11 2...
asked 1 month ago
3 votes
5 replies
Generate two random numbers whose square sum ==1
Hi I would like to generate two random numbers so that the sum of their squares is equal to 1. I have written this code. The sum of their squar...
asked 1 month ago
0 votes
2 replies
Alternative for random generator as fast as erand48() in multithreaded context?
I have a multithreaded program where each thread calls the function erand48() to generate a random number. Each thread has its own private random...
asked 1 month ago
0 votes
2 replies
Generating random 0/1 matrix with fixed features in R
I want to generate a random M x N matrix with zeros and ones with the following special properties: 1) The ones are only in m of the M rows. 2)...
asked 1 month ago
0 votes
1 replies
Why is this program outputting the same results 4 times? [duplicate]
This question already has an answer here: srand() — why call it only once? 7 ans...
asked 1 month ago
-1 votes
1 replies
Assign a random number from range X for each element in list Y
I need to assign a random number from a range X for each element in list Y while minimizing the number of duplicated numbers from X. To clarify,...
asked 1 month ago
-3 votes
0 replies
How do I run loop inside if statement?
How do I run loops inside the if-else statement until equality achieved? I've tried this, but didn't work: if (!Card1.equals(Card2)){...
asked 1 month ago
-1 votes
0 replies
Randomizing and then constraining bits
I am trying to verify a CPU and I need to make some constraints for a NOOP instruction. Basically if the upper 4 bits (of a 16 bit instruction ar...
asked 1 month ago
0 votes
1 replies
I need to sample n groups of n random rows from df in R
I want to iterate n times a function that draws n rows at random from a dataframe. Since the groups consist each of 785 rows, the function is thi...
asked 1 month ago
2 votes
2 replies
How to create a big list of different UUIDs, efficiently?
I want to generate tickets for an event. I need to generate a lot of them and I decided to have the ticket number as UUIDs. The question is how t...
asked 1 month ago
-2 votes
0 replies
i need to read some specific lines in my program
so basically i need to have a list of songs and thei artists and the user is meant to try to guess the song name by getting the name of the artis...
asked 1 month ago
0 votes
2 replies
Don't Generate Same Random Number in C +- 2
srand(time(NULL)); for(i = 0; i < 100; i++) { int randomNumber = (rand() % 100) + 1 // gets a random number from 0 - 100. // do stuff...
asked 1 month ago
1 votes
1 replies
Is the rdrand instruction available on AMD FX 8350?
I am evaluating the feasibility of moving a simulation to a FX 8350. Is there a document on the availability (if not, a workaround) of the rdrand...
asked 1 month ago
1 votes
2 replies
Creating random float and float64 arrays in NumPy [duplicate]
This question already has an answer here: Can I specify a numpy dtype when generating random values?...
asked 1 month ago
0 votes
1 replies
Are numpy binomial random numbers inefficient?
I have been sampling random numbers from different distributions and just realized how slow are numpy binomial random numbers compared to other...
asked 1 month ago
0 votes
0 replies
Made a function that randomly creates a username but I can't assign the usernames to a column
I'm using openpyxl with python 3 and I'm trying to create a script that creates a random username for ten different users. Then I'm trying to get...
asked 1 month ago
-4 votes
0 replies
Why in Math.random() multiplied by 5? why not other numbers? [duplicate]
This question already has an answer here: Math.random() explanation 5 answers...
asked 1 month ago
1 votes
1 replies
Generating random priorities for a treap in C++
I am creating a treap, and I want to know, which random number generator is most suitable for generating priorities at insertion. The data set i...
0 votes
1 replies
How can I generate a random value from a distribution that is constrained by another random value from a separate probability distribution?
I have two probability distributions, a beta distribution and a lognormal distribution. What I want to do is draw a random value from within my b...
0 votes
0 replies
Multithreaded Monte Carlo pi calculation loses precision with more threads?
I am writing a simple benchmarking application to assess/compare multithreading performance of pthreads and OpenMP. To do so I use the Monte Carl...
asked 1 month ago
0 votes
1 replies
How to implement One-in-a-Million chance? [duplicate]
This question already has an answer here: How do I generate random integers within a specific range in Java?...
asked 1 month ago
-1 votes
2 replies
Weird Random behavior [duplicate]
This question already has an answer here: Random number generator only generating one random number...
asked 1 month ago