# TRandom3 problem setting seed

**URL:** <https://root-forum.cern.ch/t/trandom3-problem-setting-seed/53850>\
**Category:** ROOT\
**Created:** [March 2, 2023, 5:34pm UTC](https://root-forum.cern.ch/t/trandom3-problem-setting-seed/53850 "2023-03-02T17:34:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Javier\_Galan](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/javier_galan/32/29662_2.png) [@Javier\_Galan](https://root-forum.cern.ch/u/Javier_Galan)\
**Post date:** [March 2, 2023, 5:34pm UTC](https://root-forum.cern.ch/t/trandom3-problem-setting-seed/53850/1 "2023-03-02T17:34:41Z")

</div>

I am a bit confused, how I should set the random generator seed? I thought I should get back the seed is 3, but I always get 624.

I get the following in a root interactive session:

```auto
   ------------------------------------------------------------------
  | Welcome to ROOT 6.26/06 https://root.cern |
  | (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Oct 11 2022, 13:18:00 |
  | From heads/latest-stable@274b476a |
  | With c++ (Debian 8.3.0-6) 8.3.0 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------------

root [0] TRandom3 *rnd = new TRandom3(3);
root [1] rnd->GetSeed()
(unsigned int) 624
root [2] rnd->SetSeed(3)
root [3] rnd->GetSeed()
(unsigned int) 624
root [4] 

```

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [March 2, 2023, 5:52pm UTC](https://root-forum.cern.ch/t/trandom3-problem-setting-seed/53850/2 "2023-03-02T17:52:45Z")

</div>

> [@Tiny number of electrons produce by TrackSrim](https://root-forum.cern.ch/t/tiny-number-of-electrons-produce-by-tracksrim/45476/2):
>
> The “624” seed value is a [TRandom3::GetSeed](https://root.cern/doc/master/classTRandom3.html#a8dde2ed63113547d685ba77a4574d6eb) incompatibility introduced in ROOT 6.24/00. You can get the backward compatible behavior when you use, e.g.: gRandom-\>TRandom::GetSeed()

---

<div class="post-metadata">

**Author:** ![Javier\_Galan](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/javier_galan/32/29662_2.png) [@Javier\_Galan](https://root-forum.cern.ch/u/Javier_Galan)\
**Post date:** [March 2, 2023, 8:59pm UTC](https://root-forum.cern.ch/t/trandom3-problem-setting-seed/53850/3 "2023-03-02T20:59:35Z")

</div>

Ok, if I use `gRandom->TRandom::GetSeed()` I recover back the good seed. But I do not understand why `fRandom->GetSeed()` just does not return the good seed value, since it is the most intuitive way.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [March 16, 2023, 8:59pm UTC](https://root-forum.cern.ch/t/trandom3-problem-setting-seed/53850/4 "2023-03-16T20:59:42Z")

</div>

Closed on March 16, 2023, 8:59pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
