(1) How do I generate random numbers in ROOT? I wanted to use random numbers between 2.5 and 5.0 but with more favor on the 5.0 than 2.5. Where numbers closer to 5.0 occur twice as those closer to 2.5.
(2) What do you mean by “normalized Gaussian prior |x| < 2”? Does it mean this:
thanks in advance for your help.
about 1: you can generate random numbers using TRandom3, e.g.
const auto random_number = r.Rndm ()
That gives you pseudo-random numbers distributed uniformly between 0 and 1. You should be able to manipulate the uniform distributions to get the distribution you want.
About 2: can you provide a bit more context for the quote?
thanks Enrico… for number 2, it’s like get a number in |x| < 2 with a normalized gaussian distribution. i don’t know if i got it right… for number 1, i am still thinking deeply…
for (1) you need to assume a distribution from which generate. For example you can use a linear function that is equal to 1 for x = 2.5 and 2 for x = 5
double x = f.GetRandom();
for 1) you need to generate using gRandom->Gaus(0,1) and discard the numbers greater or equal than 2.
Thanks and how to make generation of 3 arrays