A random-seed is used to initialize a pseudo-random number generator in many programming languages.
Questions tagged [random-seed]
937 questions
-1
votes
1 answer
Why my random number generator isn't working
Checked the output and the seed is generating the same three numbers and it's annoying. Once, the seed-generator was working fine, however, it begin doing the same thing generating the same three numbers. In both the main and random_in_unit_sphere()…

Justin
- 1
- 1
- 4
-1
votes
1 answer
Random function prediction in Python
According to the documentation of Random library, assuming the developer does not provide any seed(None) the function uses the system current time as a seed(time.time()).
Unfortunately, it seems the output doe not reflects the…

TheAsker
- 23
- 2
-1
votes
1 answer
rand.Intn generating same random sequences multiple time
I am trying to write a function that generates a random sequence with an alphanumeric character, Unfortunately, the function returns the same random sequence when calling multiple times.
I even tried by seeding the rand with…

Murali Krishna Bellamkonda
- 407
- 5
- 16
-1
votes
2 answers
Choose a number between 1-10 game can't generate different / new number after each round
I'm trying to work on an app/small game that is about trying to guess the same number between 1-10 same as the program and win, but after that round you are supposed to be able to play again! My problem is that the program generates the same number…

jujuju199
- 11
- 2
-1
votes
1 answer
Is there a way to calculate tgammaf(50) on a device using cuda?
I am using stirling's approximation to calculate this, but I am having trouble storing the huge answer I get from Stirling's approximation. Is there any good way to store such a big number on the device?

Anik Chaudhuri
- 65
- 1
- 6
-1
votes
2 answers
Converting R if (seed) statement into Python
Working on a project for my Stats class and I've hit a roadblock...
I need to convert this code, given by the professor...
# Set seed if required and determine if seed is not an integer
#
if(!is.null(seed)) {
…

Jack Karrde
- 121
- 1
- 5
-1
votes
2 answers
How come rand is not producing random numbers in my code?
I want to randomize variables a and b to output a random number 1 through 4 in the format of a,b. However, when I run my following code, the output is always the same no matter how many times I run it. For example, the output is always: 4,3 (same…

Anna Nguyen
- 33
- 1
- 11
-1
votes
1 answer
How to reproduce that array efficiently in python/numpy?
I have the following array that I want to reproduce using sp.random.seed(10):
[[ 0. 0.09174312 0.18348624 0.27522936 0.36697248 0.4587156
0.55045872 0.64220183 0.73394495 0.82568807 0.91743119 1.00917431
1.10091743 …

Carina
- 3
- 2
-1
votes
4 answers
beginner: How to convert random generated number into number from 1 to 7
I am still a beginner to the world of programing in c lang and i would like if i get your help!
#include
#include
#include
int main()
{
int week;
/* Input week number from user */
printf("Enter week…

MOHAMAD AG
- 7
- 1
-1
votes
1 answer
a question about "randoms and my question"
example:
import random
random.seed(10)
n1=random.randint(1,5)
n2=random.randint(1,5)
print(n1,n2) # => 5,1
I am not good at English, so I used a translator. Please understand if it's awkward.
If there is the same number in parentheses behind the…

2teu Han
- 3
- 1
-1
votes
1 answer
C++ same values are randomly generating with two for loops
So I am working on this for loop(s) here:
for (int i = 0; i < num; i++) {
for (int i = 0; i < length; i++) {
Str += randGen();
}
cout << Str << endl;
}
}
And for context, the integer 'length' is a…

Marc M.
- 39
- 3
-1
votes
1 answer
New to arduino. "Random" values are repeating upon reset
I am coding a roulette game in arduino's C++ based environment that flashes LEDs to represent the ball circling and stopping. My problem is that the ball stops at the same location every time. I am using randomSeed(analogRead(0)) combined with…

Jake Sak
- 40
- 7
-1
votes
1 answer
Random Number array. C
I'm new to C and I am currently trying to make a randomly generated array of ints. I think I've almost got it but wanting it to have a range of 0 to 1000. Also the output I'm not sure how to format.
srand ( time(NULL) );
int…

Ste
- 7
- 2
-1
votes
1 answer
Random numbers seeded by time don't change
To generate random numbers between 0 and 1, I have written the following but of code:
double random_0_to_1(){
srand (time(NULL));
random();
return (double)random() / (double)RAND_MAX;
}
int main(){
for(int i = 0 ; i < 10 ; i++){
…

Vincent VD
- 51
- 4
-1
votes
3 answers
Excel VBA Seed based on the date
I'm working on a programm where I use a seed. This seed should be based on the date, so every single day i get a new value. Using the seed several times a day should not change the value getting back.
This is what my seed looks…

J.schmidt
- 721
- 5
- 27