Sourcing a random number from a data-driven distribution

Hi all,

Suppose I have data from an arbitrary time series, say X(t). Before analyzing X(t) I want to perform some studies just on the distribution of X with no temporal information involved. I have been asked to create a bunch of pseudo-data sets which look like the distribution of X so that I can create pseudo-data time series, lets call them Y(t) which look like X(t) but aren’t real data.

The problem I have then is that I want to somehow randomly generate the Y-distribution pulled from a distribution based on the true X values. In my case the X values don’t resemble something like a Gaussian or Binomial or any of the other predefined distributions that TRandom can pull from. I know that TRandom can pull from a user defined TF1, 2, or 3 but is there a way I can supply TRandom my data histogram (of the distribution of X values) and for it to then use THAT to create the random Y values? Or is my only option to try and approximate the X distribution as best as possible with a TFunction?

I hope this wasn’t too confusing but any suggestions are welcome.


Hi John,

did you try the GetRandom method?


1 Like

This is exactly what I needed! I had been looking in the TRandom class instead though. Thank you very much D!


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