org.apache.ignite.ml.util.generators.primitives.scalar

## Class DiscreteRandomProducer

- java.lang.Object
- - org.apache.ignite.ml.util.generators.primitives.scalar.DiscreteRandomProducer

- All Implemented Interfaces:
    Supplier<Double>, RandomProducer

      public class DiscreteRandomProducer
      extends Object

  Pseudorandom producer generating values from user provided discrete distribution.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DiscreteRandomProducer(double... probs)` Creates an instance of DiscreteRandomProducer.
    `DiscreteRandomProducer(long seed, double... probs)` Creates an instance of DiscreteRandomProducer.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Random` | `generator()`
    `Double` | `get()`
    `int` | `getInt()`
    `static double[]` | `randomDistribution(int numOfValues)` Generates pseudorandom discrete distribution.
    `static double[]` | `randomDistribution(int numOfValues, long seed)` Generates pseudorandom discrete distribution.
    `int` | `size()`
    `static DiscreteRandomProducer` | `uniform(int numOfValues)` Creates a producer of random values from uniform discrete distribution.
    `static DiscreteRandomProducer` | `uniform(int numOfValues, long seed)` Creates a producer of random values from uniform discrete distribution.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.ignite.ml.util.generators.primitives.scalar.RandomProducer

      `noizify, noizify, vectorize, vectorize`

- - ### Constructor Detail

    - #### DiscreteRandomProducer

          public DiscreteRandomProducer(double... probs)

      Creates an instance of DiscreteRandomProducer.
      Parameters:
        `probs` - Discrete distribution probabilities.

    - #### DiscreteRandomProducer

          public DiscreteRandomProducer(long seed,
                                        double... probs)

      Creates an instance of DiscreteRandomProducer.
      Parameters:
        `seed` - Seed.
        `probs` - Discrete distribution probabilities.

  - ### Method Detail

    - #### uniform

          public static DiscreteRandomProducer uniform(int numOfValues)

      Creates a producer of random values from uniform discrete distribution.
      Parameters:
        `numOfValues` - Number of distinct values.
      Returns:
        Producer.

    - #### uniform

          public static DiscreteRandomProducer uniform(int numOfValues,
                                                       long seed)

      Creates a producer of random values from uniform discrete distribution.
      Parameters:
        `numOfValues` - Number of distinct values.
        `seed` - Seed.
      Returns:
        Producer.

    - #### randomDistribution

          public static double[] randomDistribution(int numOfValues)

      Generates pseudorandom discrete distribution.
      Parameters:
        `numOfValues` - Number of distinct values of pseudorandom variable.
      Returns:
        Probabilities array.

    - #### randomDistribution

          public static double[] randomDistribution(int numOfValues,
                                                    long seed)

      Generates pseudorandom discrete distribution.
      Parameters:
        `numOfValues` - Number of distinct values of pseudorandom variable.
        `seed` - Seed.
      Returns:
        Probabilities array.

    - #### get

          public Double get()

    - #### getInt

          public int getInt()

      Returns:
        Value of preudorandom discrete variable.

    - #### size

          public int size()

      Returns:
        Count of distinct values of distribution.

    - #### generator

          protected Random generator()

      Returns:
        Java pseudo-random values generator.

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023