<p>Given that it is virtually impossible for a human to predict what random numbers will be generated given a certain seed, and what effects they will have for a given application, the choice of the seed can be considered arbitrary.</p>

<p>What matters is that fixing the seed should fix the behaviour of the application. What seed has been chosen does not really matter, as long as it is documented.</p>

<p>The choice of <code>42</code> could therefore well come from one of the reasons you propose. Only the authors of the programs could confirm.</p>

CC BY-SA 4.0
2019-07-09T12:42:06.477Z
2019-07-09T12:42:06.477Z
bli
<p>The <code>RunPCA()</code> in Seurat 3.0 function has <code>seed.use=42</code> by default. How does one choose a seed number? Is this chosen simply because it is the Answer to the Ultimate Question of Life, the Universe, and Everything? Or maybe Lewis Carroll's curious obsession with the number?</p>

CC BY-SA 4.0
2019-07-09T13:31:25.777Z
Any integer >= 0 (but not *too* large) can make a good seed, `42` is a popular choice for the reasons you note, https://www.residentmar.io/2016/07/08/randomly-popular.html and https://blog.semicolonsoftware.de/the-most-popular-random-seeds/
Chris_Rands
CC BY-SA 4.0
2019-07-09T13:37:06.453Z
The authors of the Mash and sourmash algorithms use 42 as the seed for the MurmurHash3 *k*-mer hashing function, and I understood this to be a nod to the Hitchhiker's Guide as you suggested. So the idea isn't *completely* without precedent. 
Daniel Standage
<r><seurat>
Why is 42 the seed used in RunPCA() in Seurat?
# Why is 42 the seed used in RunPCA() in Seurat?

(Asked by: username_0 on 2019-07-08)

The `RunPCA()` in Seurat 3.0 function has `seed.use=42` by default. How does one choose a seed number? Is this chosen simply because it is the Answer to the Ultimate Question of Life, the Universe, and Everything? Or maybe Lewis Carroll's curious obsession with the number?

**Tags:** r, seurat
> **Comments:**
> **username_1**: Any integer >= 0 (but not *too* large) can make a good seed, `42` is a popular choice for the reasons you note, https://www.residentmar.io/2016/07/08/randomly-popular.html and https://blog.semicolonsoftware.de/the-most-popular-random-seeds/  
> **username_2**: The authors of the Mash and sourmash algorithms use 42 as the seed for the MurmurHash3 *k*-mer hashing function, and I understood this to be a nod to the Hitchhiker's Guide as you suggested. So the idea isn't *completely* without precedent.   

---

## 1 answers

### Answer by username_3 on 2019-07-09. Score: 3 | Accepted answer

Given that it is virtually impossible for a human to predict what random numbers will be generated given a certain seed, and what effects they will have for a given application, the choice of the seed can be considered arbitrary.

What matters is that fixing the seed should fix the behaviour of the application. What seed has been chosen does not really matter, as long as it is documented.

The choice of `42` could therefore well come from one of the reasons you propose. Only the authors of the programs could confirm.


---

