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

RandomSource to support creating byte[] seed for implementing class.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Implemented
    • 1.3
    • 1.3
    • simple
    • None

    Description

      Each implementing class represented by RandomSource has a defined seed type. The internal package knows the type and can create appropriate seeds. This occurs when a null seed is passed to the factory method create(RandomSource, ...).

      Notably the seed generation functionality satisfies any extra requirements of the generator such as avoiding all zero bytes and, for example, low complexity bytes for the MiddleSquareWeylSequence class.

      The seed generation functionality can be exposed to allow:

      1. Generation of a seed that exactly matches that generated in the factory create method
      2. Generation of a seed using a user defined source of randomness

      This requires 2 new methods in RandomSource:

      // To use the factory source of randomness
      public byte[] createSeed();
      
      // To use a user-defined source of randomness
      public byte[] createSeed(UniformRandomProvider rng);
      

      This would allow separation of seed generation from RNG construction:

      RandomSource source = ...;
      UniformRandomProvider rng = RandomSource.create(source);
      

      Becomes

      RandomSource source = ...;
      byte[] seed = source.createSeed();
      // Some later point
      UniformRandomProvider rng = RandomSource.create(source, seed);
      

      An example of a user-defined source of randomness:

      RandomSource source = ...;
      UniformRandomProvider seedRng = new JDKRandomWrapper(new SecureRandom());
      byte[] seed = source.createSeed(seedRng);
      UniformRandomProvider rng = RandomSource.create(source, seed);
      

      Attachments

        Issue Links

          Activity

            People

              aherbert Alex Herbert
              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 - 0.5h
                  0.5h