test_class.file: modules/ml/src/test/java/org/apache/ignite/ml/util/generators/primitives/scalar/UniformRandomProducerTest.java
test_class.identifier: UniformRandomProducerTest
test_case.body: @Test
      public void testGet() {
          Random random = new Random(0L);
          double[] bounds = Arrays.asList(random.nextInt(10) - 5, random.nextInt(10) - 5)
              .stream().sorted().mapToDouble(x -> x)
              .toArray();
  
          double min = Math.min(bounds[0], bounds[1]);
          double max = Math.max(bounds[0], bounds[1]);
  
          double mean = (min + max) / 2;
          double variance = Math.pow(min - max, 2) / 12;
          UniformRandomProducer producer = new UniformRandomProducer(min, max, 0L);
  
          final int N = 500000;
          double meanStat = IntStream.range(0, N).mapToDouble(i -> producer.get()).sum() / N;
          double varianceStat = IntStream.range(0, N).mapToDouble(i -> Math.pow(producer.get() - mean, 2)).sum() / N;
  
          assertEquals(mean, meanStat, 0.01);
          assertEquals(variance, varianceStat, 0.1);
      }
test_case.class_method_signature: UniformRandomProducerTest.testGet()
test_case.full_signature: @Test public void testGet()
test_case.identifier: testGet
test_case.invocations: toArray mapToDouble sorted stream asList nextInt nextInt min max pow sum mapToDouble range get sum mapToDouble range pow get assertEquals assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGet()
focal_class.declarator: from
focal_class.modifier: private final
focal_class.original_string: private final double from;
focal_class.type: double
focal_class.var_name: from
focal_class.declarator: to
focal_class.modifier: private final
focal_class.original_string: private final double to;
focal_class.type: double
focal_class.var_name: to
focal_class.file: modules/ml/src/main/java/org/apache/ignite/ml/util/generators/primitives/scalar/UniformRandomProducer.java
focal_class.identifier: UniformRandomProducer
focal_class.class_method_signature: UniformRandomProducer.UniformRandomProducer(double from, double to)
focal_class.full_signature: public  UniformRandomProducer(double from, double to)
focal_class.identifier: UniformRandomProducer
focal_class.modifiers: public
focal_class.parameters: (double from, double to)
focal_class.signature:  UniformRandomProducer(double from, double to)
focal_class.class_method_signature: UniformRandomProducer.UniformRandomProducer(double from, double to, long seed)
focal_class.full_signature: public  UniformRandomProducer(double from, double to, long seed)
focal_class.identifier: UniformRandomProducer
focal_class.modifiers: public
focal_class.parameters: (double from, double to, long seed)
focal_class.signature:  UniformRandomProducer(double from, double to, long seed)
focal_class.class_method_signature: UniformRandomProducer.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.superclass: extends RandomProducerWithGenerator
focal_method.body: @Override public Double get() {
          double result = generator().nextDouble() * (to - from) + from;
          if (result > to)
              result = to;
  
          return result;
      }
focal_method.class_method_signature: UniformRandomProducer.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()