GetRandom() == same events all the time (BIG DATA)

Place to post and discuss training related to using open source software.

Moderator: carrier

GetRandom() == same events all the time (BIG DATA)

Postby Monica12 » Fri May 13, 2016 12:25 pm

I am trying to draw a random sample of events from a parent distribution given by a histogram I have previously generated. I am using the TH1:GetRandom() call.

I find that I am however getting the same events every time I run the code. I am calling gRandom->SetSeed(0) at the very start of the code.

Can anyone explain how to fix this. Is there a way to use the TRandom1 generator for the TH1:GetRandom() process?
Monica12
 
Posts: 1
Joined: Fri May 13, 2016 12:17 pm

Re: GetRandom() == same events all the time (BIG DATA)

Postby Neeraj Kumar123 » Wed May 25, 2016 8:53 am

To get an answer to the mentioned question, you need to include gRandom=new TRandom3(0); if you are using TH1::GETRandom since TH1::GetRandom uses gRandom and not the confined instance of TRandom3 that you initialize in your code.
Answer source: for further clarifications of the concepts, please visit intellipaat.
Neeraj Kumar123
 
Posts: 1
Joined: Wed May 25, 2016 8:43 am


Return to Training

Who is online

Users browsing this forum: No registered users and 1 guest