Function

NumCosmoMathRNGDiscretenew

Declaration [src]

NcmRNGDiscrete*
ncm_rng_discrete_new (
  const gdouble* weights,
  const guint n
)

Description [src]

Creates a new NcmRNGDiscrete. This object is used to generate random numbers from a discrete distribution for the given set of weights.

Parameters

weights

Type: An array of gdouble

Array of weights.

The length of the array is specified in the n argument.
The data is owned by the caller of the function.
n

Type: const guint

Number of elements in weights.

Return value

Type: NcmRNGDiscrete

A new NcmRNGDiscrete.

The caller of the function takes ownership of the data, and is responsible for freeing it.