class_docstr: Generate random variables distributed according to an arbitrary function
  
  Parameters
  ----------
  func : function
      func should take an array of x values, and return an array
      proportional to the probability density at each value
  xmin : float
      minimum value of interest
  xmax : float
      maximum value of interest
  Nx : int (optional)
      number of samples to draw.  Default is 1000
  random_state : None, int, or np.random.RandomState instance
      random seed or random number generator
  func_args : dictionary (optional)
      additional keyword arguments to be passed to func
code: def __init__(
      self, func, xmin, xmax, Nx=1000, random_state=None, func_args=None
  ):
      self.random_state = check_random_state(random_state)
  
      if func_args is None:
          func_args = {}
  
      x = np.linspace(xmin, xmax, Nx)
      Px = func(x, **func_args)
  
      # if there are too many zeros, interpolation will fail
      positive = Px > 1e-10 * Px.max()
      x = x[positive]
      Px = Px[positive].cumsum()
      Px /= Px[-1]
  
      self._tck = interpolate.splrep(Px, x)
  
file_path: astroML/astroML/density_estimation/empirical.py
imports: import numpy
  from scipy import interpolate
  from sklearn.utils import check_random_state
label_desc: Use image node_id 1 to create a new FunctionDistribution object  with example: obj = FunctionDistribution(func, xmin, xmax, Nx, random_state, func_args)