test_class.file: modules/ml/src/test/java/org/apache/ignite/ml/util/generators/primitives/scalar/DiscreteRandomProducerTest.java
test_class.identifier: DiscreteRandomProducerTest
test_case.body: @Test
      public void testGet() {
          double[] probs = new double[] {0.1, 0.2, 0.3, 0.4};
          DiscreteRandomProducer producer = new DiscreteRandomProducer(0L, probs);
  
          Map<Integer, Double> counters = new HashMap<>();
          IntStream.range(0, probs.length).forEach(i -> counters.put(i, 0.0));
  
          final int N = 500000;
          Stream.generate(producer::getInt).limit(N).forEach(i -> counters.put(i, counters.get(i) + 1));
          IntStream.range(0, probs.length).forEach(i -> counters.put(i, counters.get(i) / N));
  
          for (int i = 0; i < probs.length; i++)
              assertEquals(probs[i], counters.get(i), 0.01);
  
          assertEquals(probs.length, producer.size());
      }
test_case.class_method_signature: DiscreteRandomProducerTest.testGet()
test_case.full_signature: @Test public void testGet()
test_case.identifier: testGet
test_case.invocations: forEach range put forEach limit generate put get forEach range put get assertEquals get assertEquals size
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGet()
focal_class.declarator: EPS = 1e-5
focal_class.modifier: private static final
focal_class.original_string: private static final double EPS = 1e-5;
focal_class.type: double
focal_class.var_name: EPS
focal_class.declarator: probs
focal_class.modifier: private final
focal_class.original_string: private final double[] probs;
focal_class.type: double[]
focal_class.var_name: probs
focal_class.declarator: ids
focal_class.modifier: private final
focal_class.original_string: private final int[] ids;
focal_class.type: int[]
focal_class.var_name: ids
focal_class.file: modules/ml/src/main/java/org/apache/ignite/ml/util/generators/primitives/scalar/DiscreteRandomProducer.java
focal_class.identifier: DiscreteRandomProducer
focal_class.class_method_signature: DiscreteRandomProducer.DiscreteRandomProducer(double... probs)
focal_class.full_signature: public  DiscreteRandomProducer(double... probs)
focal_class.identifier: DiscreteRandomProducer
focal_class.modifiers: public
focal_class.parameters: (double... probs)
focal_class.signature:  DiscreteRandomProducer(double... probs)
focal_class.class_method_signature: DiscreteRandomProducer.DiscreteRandomProducer(long seed, double... probs)
focal_class.full_signature: public  DiscreteRandomProducer(long seed, double... probs)
focal_class.identifier: DiscreteRandomProducer
focal_class.modifiers: public
focal_class.parameters: (long seed, double... probs)
focal_class.signature:  DiscreteRandomProducer(long seed, double... probs)
focal_class.class_method_signature: DiscreteRandomProducer.uniform(int numOfValues)
focal_class.full_signature: public static DiscreteRandomProducer uniform(int numOfValues)
focal_class.identifier: uniform
focal_class.modifiers: public static
focal_class.parameters: (int numOfValues)
focal_class.return: DiscreteRandomProducer
focal_class.signature: DiscreteRandomProducer uniform(int numOfValues)
focal_class.class_method_signature: DiscreteRandomProducer.uniform(int numOfValues, long seed)
focal_class.full_signature: public static DiscreteRandomProducer uniform(int numOfValues, long seed)
focal_class.identifier: uniform
focal_class.modifiers: public static
focal_class.parameters: (int numOfValues, long seed)
focal_class.return: DiscreteRandomProducer
focal_class.signature: DiscreteRandomProducer uniform(int numOfValues, long seed)
focal_class.class_method_signature: DiscreteRandomProducer.randomDistribution(int numOfValues)
focal_class.full_signature: public static double[] randomDistribution(int numOfValues)
focal_class.identifier: randomDistribution
focal_class.modifiers: public static
focal_class.parameters: (int numOfValues)
focal_class.return: double[]
focal_class.signature: double[] randomDistribution(int numOfValues)
focal_class.class_method_signature: DiscreteRandomProducer.randomDistribution(int numOfValues, long seed)
focal_class.full_signature: public static double[] randomDistribution(int numOfValues, long seed)
focal_class.identifier: randomDistribution
focal_class.modifiers: public static
focal_class.parameters: (int numOfValues, long seed)
focal_class.return: double[]
focal_class.signature: double[] randomDistribution(int numOfValues, long seed)
focal_class.class_method_signature: DiscreteRandomProducer.get()
focal_class.full_signature: @Override public Double get()
focal_class.identifier: get
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Double
focal_class.signature: Double get()
focal_class.class_method_signature: DiscreteRandomProducer.getInt()
focal_class.full_signature: public int getInt()
focal_class.identifier: getInt
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getInt()
focal_class.class_method_signature: DiscreteRandomProducer.size()
focal_class.full_signature: public int size()
focal_class.identifier: size
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int size()
focal_class.class_method_signature: DiscreteRandomProducer.sort(double[] probs, int[] idx, int from, int to)
focal_class.full_signature: private void sort(double[] probs, int[] idx, int from, int to)
focal_class.identifier: sort
focal_class.modifiers: private
focal_class.parameters: (double[] probs, int[] idx, int from, int to)
focal_class.return: void
focal_class.signature: void sort(double[] probs, int[] idx, int from, int to)
focal_class.superclass: extends RandomProducerWithGenerator
focal_method.body: @Override public Double get() {
          double p = generator().nextDouble();
          for (int i = 0; i < probs.length; i++) {
              if (probs[i] > p)
                  return (double)ids[i];
          }
  
          return (double)ids[probs.length - 1];
      }
focal_method.class_method_signature: DiscreteRandomProducer.get()
focal_method.full_signature: @Override public Double get()
focal_method.identifier: get
focal_method.invocations: nextDouble generator
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: Double
focal_method.signature: Double get()