A random-seed is used to initialize a pseudo-random number generator in many programming languages.
Questions tagged [random-seed]
937 questions
27
votes
4 answers
Generating uniform random numbers in Lua
I am working on programming a Markov chain in Lua, and one element of this requires me to uniformly generate random numbers. Here is a simplified example to illustrate my question:
example = function(x)
local r = math.random(1,10)
print(r)
…

Starfish_Prime
- 287
- 1
- 3
- 5
26
votes
5 answers
Setting seed for Excel random number generator
In excel below formula will generate random number from a normal distribution with mean 10 and variance 1. Is there a way to set a fix seed so that i get a fix set of random numbers all the time? I am using Excel 2010
=NORMINV(RAND(),10,1)

user2543622
- 5,760
- 25
- 91
- 159
25
votes
9 answers
Reproducible results in Tensorflow with tf.set_random_seed
I am trying to generate N sets of independent random numbers. I have a simple code that shows the problem for 3 sets of 10 random numbers. I notice that even though I use the tf.set_random_seed to set the seed, the results of different runs do not…

Mehdi Rezaie
- 306
- 1
- 3
- 7
20
votes
1 answer
Best way to add seed to Perlin noise?
I'm trying to implement 2D Perlin noise generation in C++, and some implementations I found use no seed at all (here, here or here). Other implementations take a seed value to get different noise depending on the noise value.
However I found example…

vividos
- 6,468
- 9
- 43
- 53
19
votes
1 answer
How to cancel the effect of numpy seed()?
I would like to use np.random.seed() in the first part of my program and cancel it in the second part.
Again,
in the first part of my python file, I want the same random numbers to be generated at each execution
in the second part , I want…

u2gilles
- 6,888
- 7
- 51
- 75
17
votes
1 answer
Same seed, different OS, different random numbers in R
I was experiencing inconsistent results between two machines and a linux server, until I realized that fixing the seed was having different effects. I am running different R versions in all of them, all above 3.3.0. Here are the examples:
Linux 1
>…

epsilone
- 745
- 11
- 23
17
votes
5 answers
Repeatable pagination with randomly ordered rows
I have API that returns dome paginated rows from DB. It works, however when I order rows by RANDOM() I get duplicates on consecutive pages. Is there any option to set random seed per query?
If not is it possible to set random SEED globally to force…

user606521
- 14,486
- 30
- 113
- 204
16
votes
2 answers
What is the $RANDOM_SEED$ file generated by Visual Studio build of C# solution?
We noticed that on a certain dev machine a Visual Studio (2015 update 3) debug build of a C# solution was generating a $RANDOM_SEED$ file alongside every built DLL.
The content of the file is just a single number e.g.
1443972318
Deleting the file(s)…

Nick Baker
- 717
- 4
- 27
14
votes
1 answer
Why using numpy.random.seed is not a good practice?
I want to do reproducible tests that use random numbers as inputs. I am used to invoke rng in Matlab and numpy.random.seed in Python. However, I noticed that the Notes section of seed's help reads:
This is a convenience, legacy function.
The best…

Gabriel Gleizer
- 185
- 8
14
votes
1 answer
How to save and load random number generator state in Pytorch?
I am training a DL model in Pytorch, and want to train my model in a deterministic way.
As written in this official guide, I set random seeds like this:
np.random.seed(0)
torch.manual_seed(0)
torch.backends.cudnn.deterministic =…

hajduistvan
- 143
- 1
- 5
14
votes
3 answers
Is it possible to reverse a pseudo random number generator?
Is it possible to reverse a pseudo random number generator?
For example, take an array of generated numbers and get the original seed.
If so, how would this be implemented?

Cenregoth
- 173
- 1
- 1
- 6
14
votes
6 answers
Random number from a seed
I have an application where it becomes extremely noticeable if my program uses an RNG that has patterns based on its seed, as it builds landscapes based on the x coordinate of the landscape. While Random works well if you're calling Next() every…

Mike Precup
- 4,148
- 21
- 41
14
votes
4 answers
Does one need to call srand() C function per thread or per process to seed the randomizer?
The caption pretty much says it.
PS. This is for C++ Windows program.

ahmd0
- 16,633
- 33
- 137
- 233
13
votes
2 answers
How can I input an integer seed for producing random numbers using the rand crate in Rust?
In a Rust project, I want to generate reproducible random numbers based on a integer seed as I'm used to in Java.
The documentation for Seed in the rand crate states:
Seed type, which is restricted to types mutably-dereferencable as u8 arrays (we…

Katharina
- 243
- 2
- 5
13
votes
1 answer
Making functions that set the random seed independent
Sometimes I want to write a randomized function that always returns the same output for a particular input. I've always implemented this by setting the random seed at the top of the function and then proceeding. Consider two functions defined in…

josliber
- 43,891
- 12
- 98
- 133