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

Instance create() method for RandomSource

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Trivial
    • Resolution: Implemented
    • 1.3
    • 1.4
    • simple
    • None

    Description

      This is a wish for an instance create method for RandomSource:

      public RestorableUniformRandomProvider create() {
          return create(this);
      }
      
      public RestorableUniformRandomProvider create(Object seed,
                                                    Object... data) {
          return create(this, seed, data);
      }
      

      It is syntactic sugar to avoid typing the use of the static factory method and repeating RandomSource in close succession:

      RandomSource.create(RandomSource.MT);
      RandomSource.create(RandomSource.MT, 12345L);
      

      Becomes:

      RandomSource.MT.create();
      RandomSource.MT.create(12345L);
      

      It would make the use of the static factory method redundant, which could be deprecated.

      Opinions on this?

      Attachments

        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 - 50m
                50m