Uploaded image for project: 'Commons RNG'
  1. Commons RNG
  2. RNG-133

LineSampler: Sample uniformly within a line

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Implemented
    • 1.4
    • 1.4
    • sampling
    • None

    Description

      Create a sampler to sample uniformly within a line:

      public abstract class LineSampler implements 
              SharedStateSampler<LineSampler> {
          public static LineSampler of(double[] a,
                                       double[] b,
                                       UniformRandomProvider rng);
      }
      

      Sampling can be performed using the same method as the TriangleSampler without the third coordinate:

      v = b - a
      p = a + s * v
      
      with s a uniform deviate in [0, 1]
      

      To allow computation with any finite coordinates the vector does not require computation:

      p = a + s * (b - a)
        = a + sb - sa
        = (1 - s)a + sb
      

      This is the same method used in the ContinuousUniformSampler but extended to N-dimensions.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              aherbert Alex Herbert
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m