969
questions
1
vote
1
answer
55
views
Seeding value in PHP
I was going through this article
https://www.ambionics.io/blog/php-mt-rand-prediction
which claims that if we use mt_rand(), we can get the seed value using two values instead of brute forcing.
In the ...
0
votes
0
answers
36
views
Random number generation in R not working [closed]
I have set a seed in R, but the sample function keeps coming up with different answers each time. Could someone help?
> set.seed(100)
> sample(1:10, 3, replace = FALSE)
[1] 10 7 6
> sample(...
2
votes
0
answers
36
views
Subclassing random.Random produces different results with same seed
I've run into something I don't understand. This code:
import random
class MyRandom(random.Random):
pass
r = random.Random()
r.seed(10)
print(r.randint(0, 20))
print(r.randint(0, 20))
print(r....
0
votes
0
answers
20
views
How should I set the seeds for worker processes when using ProcessPoolExecutor in Python?
I'm trying to write Python code for a simulation in which each worker process generates a random sample of a user-specified size from a user-specified distribution and then performs some calculations ...
1
vote
0
answers
50
views
I have fixed all the seeds in Python, but still get different results
This program is to train an agent via reinforcement learning, and the whole algorithm is totally written by myself.
As follows, I have set all the seeds and other details mentioned in other similar ...
-3
votes
0
answers
36
views
Remembering the position I'm on with a preset Random Seed
I have a set random seed I'm using in Unity Game (Technically I'm using the C# implementation of the Random Class, not Unity's, so this should be applicable to any C# script, not just a Unity Gmae). ...
1
vote
0
answers
12
views
How do I set the seed for predictive modeling with glm.nb?
I’m uncertain about how to set the seed for training the model. When I use different seeds, the results vary. Is there a gold standard for choosing a seed, or should I try multiple seeds and select ...
0
votes
0
answers
70
views
Resolving : virt-customize: warning: random seed could not be set for this type of guest
To resolve this issue, you can create a random seed in the disk image using this commands :
debian : sudo apt-get install libguestfs-tools
mkdir -p /mnt/test
guestmount -a disk-image.img -i --rw /mnt/...
1
vote
0
answers
73
views
How to set random seeds globally?
I have observed that when I set the random seed using np.random.seed(seed) and then generate random numbers in a loop, as shown below:
import numpy as np
np.random.seed(4)
for i in range(3):
...
0
votes
1
answer
78
views
Does a sequence of random seeds generate a pseudo-random sequence?
Sorry for the convoluted title. Basically, my question is: can we say that the sequence produced by the following sequence() function is pseudo-random?
import numpy as np
def sequence(int n):
x = ...
1
vote
0
answers
28
views
Starting a random number sequence using seed in fortran 95 [duplicate]
I am writing a fortran 95 code for Brownian dynamics. So I need to insert random numbers at each time-step. To generate the random numbers or 'noise', which needs to be Gaussian white noise, I am ...
2
votes
1
answer
67
views
Confusion regarding functions to generate random numbers in numpy
I am confused primarily on two points:
Why are there different random number generator functions in numpy that seemingly produce the same thing? e.g. np.random.rand() vs np.random.uniform(); or np....
0
votes
1
answer
74
views
Exact way of defining seed for random number generation in fortran
I am trying to simulate a physical problem (Brownian dynamics) for which I need to generate random numbers.
Previously, I was just using the following to choose random numbers from a Gaussian ...
1
vote
1
answer
79
views
Select a random number for a certain seed, being sure the previous seed doesn't select the same random number
Say I have a random number generator which takes a seed and gives a number between 1 and 10.
Say I have a seed '100'. This would generate a random number '4'. How would I be sure that this number isn'...
0
votes
1
answer
96
views
Store numbers as "random" seed
Is it possible to calculate a seed from a given list of numbers, such that this seed will cause a number-generating function (like rand()) to output this list of numbers?
And, at which point does it ...
2
votes
3
answers
148
views
Does each thread have its own copy of the `rand()` prng?
I was playing around with some simple C++ code for an exam question about threading, where the threads were calling rand() (and yes, I am aware there are good reasons to use other generators, but ...
1
vote
1
answer
64
views
Matching numpy rand ndarrays with MATLAB
I'm trying to match randomly generated ndarrays from numpy with MATLAB.
import numpy as np
# Set the seed for NumPy's random generator
np.random.seed(42) #Mersenne Twister is default
# Generate ...
0
votes
1
answer
76
views
How to seed OpenSSL PRNG in Rust?
I use the openssl crate for key generation and crypto functions.
I would like to seed the PRNG (or at least add entropy from application with RAND_ADD()),.
However it seems that it is not possible (...
0
votes
0
answers
69
views
Is there a way to generate numbers in a complete random, unpredictable way?
When I was learning about random number generation, I figured out that the output often follows a guided way (for example, a point on a gaussian distribution). While this looks random enough, it is ...
3
votes
1
answer
141
views
Multiple seeds for random C++
Is there a way to pass multiple amount of number (in my case 3) as seeds for random to work with? I need the result to be pseudo-random value which is lineary distributed, so I can't just use ...
2
votes
0
answers
48
views
iOS Swift Array `randomElement` 6% bias on big sample size?
tl;dr doing Swift's Array.randomElement() brings perfect results when testing locally but in production there is a huge bias to the second element in the array and I don't know what to do about it.
...
0
votes
1
answer
71
views
Producing filtered random samples which can be replicated using the same seed
I have $10$ random variables $X_1, X_2, \ldots X_{10} \sim \mathcal{N(0,1)}$, I want to generate $5000$ samples for them such that $X_1 < a$ and $X_i > a \forall i \in {2, 3, \ldots, 10}$.
The ...
3
votes
1
answer
56
views
How to randomly sample from a skewed gaussian distribution in boost c++?
I am trying to sample a skewed gaussian distribution with the Mersenne Twister pseudo-random generator. I am using boost as the skewed gaussian distribution is not implemented in in C++ standard.
The ...
1
vote
1
answer
63
views
Can't get reproducible vector using set.seed
I'm taking a self-study introductory class in R, and the question is:
Use the grep() function to find the indices of the letter "x" and
find the frequency of "a" from the ...
0
votes
0
answers
56
views
Gnuplot: ramdom but deterministic color palette
I generate a histogram columnstacked as a stacked bar chart (see data and code below). The auto-generated diagram looks great, but the colors repeat too early (the first four colors appear twice):
I'...
0
votes
0
answers
153
views
How do I include a VS Code snippet in a Flashpost payload?
I am using the Flashpost extension in VS Code to prototype REST API calls before I publish the endpoint. What steps do I need to take to configure VS Code so that I can insert a variable into my ...
2
votes
0
answers
70
views
Inconsistent Results in TensorFlow/Keras Training on Kubernetes Cluster
I have a Python code (parallelized with dask) that trains multiple neural networks on a Kubernetes cluster. I want deterministic results, and therefore seed each worker before training the neural ...
3
votes
1
answer
98
views
c++ randomization in parallel
Counting pi using montecarlo method. Is there any way to make randomization same for any amounts of threads? In essence, what I am looking for is to obtain the same answer for every fixed combination ...
0
votes
0
answers
70
views
Setting random seed for step_downsample in repeated 10 fold cv
I'm using tidymodels to tune binary classification randomForest models using a moderately imbalanced dataset, with an approximately 1:7 positive to negative ratio in the target variable, that will ...
1
vote
1
answer
36
views
Randomisation behaviour after cloning and fitting RandomizedSearchCV
I have a basic nested CV loop, where an outer loop goes over an inner model-tuning step. My expectation is that each fold should draw a different random sample of hyperparameter values. However, in ...
1
vote
1
answer
111
views
Is there a discretised version of scipy.stats.loguniform?
When running hyperparameter tuning on a random forest, I sometimes want to specify a large integer range of values for integer parameters like min_samples_leaf (e.g. ranging from the default value of ...
1
vote
1
answer
150
views
Using tf.random.set_seed but still getting an error no attribute 'set_random_seed'
I'm trying to set seed using tf.random.set_seed instead of tf.set_random_seed, but still getting the error as module 'tensorflow' has no attribute 'set_random_seed'
Trying to run this:
def __init__(...
0
votes
0
answers
182
views
Proper use of random seeds in Jax
I am using Jax for Reinforcement Learning with DQN. For a step in the environment, I am using two alternatives regarding the generation of random seeds. These two approaches lead to significantly ...
0
votes
1
answer
348
views
How to set my seed provider openssl default?
I want to use my seed provider in openssl v3. I implemented provider but api only allows to use "EVP_RAND_generate" function.
I want to inject my seed provider into openssl default. When i ...
1
vote
2
answers
209
views
Why do I get different random numbers with the same seed?
I am using the numpy random number generator with the following MWE:
import numpy as np
np.random.seed(40)
print(np.random.randint(-3, 4))
rng = np.random.default_rng(seed=40)
print(rng.integers(-3, 4)...
0
votes
0
answers
39
views
Random generator producing same numbers by function signature [duplicate]
I have a function that produces 10 random numbers as follows:
import random
def number_generate():
numbers=[]
while len(numbers)<10:
a=int(random.random()*10)
numbers....
1
vote
0
answers
59
views
Inconsistent result of clustering number order (R)
I have parcels with the type of crop culture for each year for 5 years. I want to create a clustering of my parcels which would indicate the type of crop rotation based on the number of occurences of ...
0
votes
0
answers
118
views
Passing the Parallel API tests in PettingZoo for custom multi-agent environment
from pettingzoo.test import (
parallel_api_test,
parallel_seed_test,
max_cycles_test,
performance_benchmark,
)
I have a custom multiagent environment that extends ParallelEnv, and ...
0
votes
0
answers
98
views
Python random seed over pandas and huggingface
I am currently working on reproducing the results of a research paper, which has made its dataset available on Hugging Face Hub. The paper outlines a specific method and random generator seed, using ...
1
vote
1
answer
125
views
Setting seed while training many PyTorch models in a loop?
I have code as follows:
seed = 0
random.seed(seed)
torch.manual_seed(seed)
np.random.seed(seed)
torch.cuda.manual_seed_all(seed)
torch.cuda.manual_seed(seed)
torch.backends.cudnn.deterministic = True
...
0
votes
0
answers
55
views
Random number generator doesn't work for me ( C language) [duplicate]
For example : if i choose between 0-10 , the program generate a number above 10 which is 15 or 11 or ....
How to fixt it please ?
int randomNumbers(int max, int min){
int number;
srand(time(NULL));...
-1
votes
1
answer
64
views
How do I use the random-seed command in Netlogo to ensure runs of my model have the reproducible results?
I am currently working on a model that uses randomness in a few places. Since I want the runs of this model to have results that are reproducible, I would like the drawn numbers to be the same with ...
0
votes
1
answer
45
views
How to randomly map a proportion of data value to a specific category?
I have a dataset below which shows if a customer is a return customer or not. The end goal is for all returned customers, I need to map about 25% of them to 'yes 1 purchase' and 75% of them to 'yes &...
0
votes
0
answers
33
views
Fixed the random seed, but unable to reproduce the computational results
After fixing the random seed, two separate runs resulted in the same loss for the first batch in each run. However, after the gradient backpropagation, the subsequent batches showed similar but not ...
3
votes
2
answers
513
views
Correctly seeding numpy random generator
For my scientific experiments, I usually seed using:
rng = np.random.Generator(np.random.PCG64(seed))
which for the current numpy version is equivalent to
rng = np.random.Generator(np.random....
3
votes
2
answers
619
views
MT19937 Generator in C++ and NumPy generate different numbers
I am trying to reproduce some C++ code in Python that involves random number generations. The C++ code uses the MT19937 generator as follows:
#include <random>
#include <iostream>
int ...
0
votes
0
answers
52
views
Set seed for all python project
I have a problem with setting the seed in my project.
What I do (00_seed.py):
import numpy as np
import random
import os
import argparse
import yaml
def seed_everything(...
1
vote
1
answer
244
views
100% predictable results using GDScript's native pseudo-random number generators
I am using GDScript (Godot's Python) attempting to create an algorithm that generates random noise between an integer of 0 or 1, onto a 2 dimensional array. To do so, I am iterating with predefined ...
1
vote
0
answers
45
views
Is there any known suggestion for 32 operations version of "Squares: A Fast Counter-Based RNG"?
At proposal Squares: A Fast Counter-Based RNG Paper of: Squares: A Fast Counter-Based RNG, by Bernard Widynski
coded Git Hub: Squares: A Fast Counter-Based RNG (Random Number Generator)
it includes 64 ...
2
votes
1
answer
483
views
Is it safe to use std::mt19937 (with fixed seed) within unit tests? [duplicate]
I had written a unit test of a function that requires a Random Number Generator (RNG). The implementation of the tested function starts with the following lines:
const int nSeed = 0;
std::mt19937 ...