Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-764

New sample() API should accept RandomGenerator as parameter

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0
    • 3.1
    • None

    Description

      This may come to late as I know the 3.0 release is nearing completion, but I had some concerns about the new sample() method on the math3 RealDistribution interface.
      Specifically, there doesn't seem to be a way to supply a random generator to the sampler. Perhaps it would be better to have a factory method on the RealDistribution interface that accepted a RandomGenerator and returns an instance of some new interface, Sampler, which contains the sample() methods.
      That is:

      interface RealDistribution {
      Sampler createSampler(RandomGenerator generator);
      Sample createSampler(); // uses default RandomGenerator
      }

      interface Sampler {
      double sample();
      double[] sample(int sampleSize);
      }

      Attachments

        1. sampler-refactor.diff
          21 kB
          Alex Bertram

        Issue Links

          Activity

            People

              erans Gilles Sadowski
              alexbedatadriven Alex Bertram
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 48h
                  48h
                  Remaining:
                  Remaining Estimate - 48h
                  48h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified