# Random seed in BDT

**URL:** <https://root-forum.cern.ch/t/random-seed-in-bdt/52642>\
**Category:** TMVA\
**Created:** [December 5, 2022, 11:58am UTC](https://root-forum.cern.ch/t/random-seed-in-bdt/52642 "2022-12-05T11:58:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![petrakou](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/d78d45/32.png) [@petrakou](https://root-forum.cern.ch/u/petrakou)\
**Post date:** [December 5, 2022, 11:58am UTC](https://root-forum.cern.ch/t/random-seed-in-bdt/52642/1 "2022-12-05T11:58:22Z")

</div>

Hi,  
Is the random seed in BDT fixed or free by default?  
How can we set its value? (The manual doesn’t seem to point to a related variable.)  
Thanks.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [December 5, 2022, 12:27pm UTC](https://root-forum.cern.ch/t/random-seed-in-bdt/52642/2 "2022-12-05T12:27:40Z")

</div>

I think @moneta can help you.

---

<div class="post-metadata">

**Author:** ![petrakou](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/d78d45/32.png) [@petrakou](https://root-forum.cern.ch/u/petrakou)\
**Post date:** [December 7, 2022, 2:50pm UTC](https://root-forum.cern.ch/t/random-seed-in-bdt/52642/3 "2022-12-07T14:50:14Z")

</div>

Bumping up. I think I won’t be original if I say that this is a crucial aspect.

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [December 7, 2022, 3:03pm UTC](https://root-forum.cern.ch/t/random-seed-in-bdt/52642/4 "2022-12-07T15:03:53Z")

</div>

Hi,  
The random seed used in the BDT is by default `0`, which means a different seed depending on time, machine, etc… is used every time.  
I don’t think exist an option to set it manually, you will have to change the hard-coded values in [`DecisionTree.cxx:88`](https://root.cern.ch/doc/master/DecisionTree_8cxx_source.html)

Lorenzo

---

<div class="post-metadata">

**Author:** ![petrakou](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/d78d45/32.png) [@petrakou](https://root-forum.cern.ch/u/petrakou)\
**Post date:** [December 7, 2022, 3:17pm UTC](https://root-forum.cern.ch/t/random-seed-in-bdt/52642/5 "2022-12-07T15:17:53Z")

</div>

Thank you for the answer!

…Although it sounds pretty bad that the seed cannot be fixed for experimentation… 🥴

That being said, I’m now watching results repeating themselves exactly, when I run the same code more than once.

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [December 7, 2022, 3:28pm UTC](https://root-forum.cern.ch/t/random-seed-in-bdt/52642/6 "2022-12-07T15:28:21Z")

</div>

Which options are you using when booking the BDT method ?
