# Confusion on using TRandom3

**URL:** <https://root-forum.cern.ch/t/confusion-on-using-trandom3/37356>\
**Category:** Newbie\
**Created:** [December 28, 2019, 5:13pm UTC](https://root-forum.cern.ch/t/confusion-on-using-trandom3/37356 "2019-12-28T17:13:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hep\_1](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hep_1/32/21930_2.png) [@hep\_1](https://root-forum.cern.ch/u/hep_1)\
**Post date:** [December 28, 2019, 5:13pm UTC](https://root-forum.cern.ch/t/confusion-on-using-trandom3/37356/1 "2019-12-28T17:13:10Z")

</div>

Hi, I am new to ROOT, and I was learning how to use TRandom3. All I want to do is see how it works, and if I can generate some random numbers. I tried the following two codes:

```auto
TRandom3 rand(0);   
  for (Int_t i = 0; i<10; i++){   
    Double_t ran = rand.Rndm();  
    Double_t ran1 = rand.Rndm();

    cout<<ran<<endl;
    cout<<ran1<<endl;
  }
  }

```

When I run it, it works fine.

Then, I made a slight modification to and had the following:

```auto
TRandom3 rand(0);   
  for (Int_t i = 0; i<10; i++){   
    Double_t ran = rand.gaus(1,5);  
    Double_t ran1 = rand.gaus(2,6);

    cout<<ran<<endl;
    cout<<ran1<<endl;
  }
  }

```

The second code does not work and gives the error:

> Error: Can’t call TRandom3::gaus(1,5) in current scope randomnum1.C:21:  
> Possible candidates are…  
> (in TRandom3)  
> (in TRandom)  
> \*\*\* Interpreter error recovered \*\*\*

Could anyone help me understand why the second code does not work?

_ROOT Version:_ 5.18  
_Platform:_ Ubuntu  
_Compiler:_ Not Provided

* * *

---

<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:** [December 28, 2019, 5:47pm UTC](https://root-forum.cern.ch/t/confusion-on-using-trandom3/37356/2 "2019-12-28T17:47:25Z")

</div>

Well, a “gaus” is not a “[Gaus](https://root.cern.ch/doc/master/classTRandom.html#a0e445e213eae1343b3d22086ecb87314)”.

---

<div class="post-metadata">

**Author:** ![hep\_1](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hep_1/32/21930_2.png) [@hep\_1](https://root-forum.cern.ch/u/hep_1)\
**Post date:** [December 28, 2019, 7:59pm UTC](https://root-forum.cern.ch/t/confusion-on-using-trandom3/37356/3 "2019-12-28T19:59:02Z")

</div>

Oh yes. Thanks a lot.
