[
https://issues.apache.org/jira/browse/RNG-169?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alex Herbert updated RNG-169:
-----------------------------
Summary: Update array seed conversion to use optimum seed length (was:
Update byte[] array conversion use optimum memory allocation)
> Update array seed conversion to use optimum seed length
> -------------------------------------------------------
>
> Key: RNG-169
> URL: https://issues.apache.org/jira/browse/RNG-169
> Project: Commons RNG
> Issue Type: Improvement
> Components: simple
> Affects Versions: 1.4
> Reporter: Alex Herbert
> Priority: Trivial
> Fix For: 1.5
>
>
> The seed conversion routines in ByteArray2LongArray and ByteArray2IntArray
> can be optimised for memory usage.
> The converters can be updated to implement Seed2ArrayConverter. This allows
> the length of the output seed to be constructed to the correct length. This
> will avoid converting part of the byte[] seed that is not used.
> In addition the input seed is expanded if it is not modulus 8 or 4
> respectively using Arrays.copyOf. This will zero fill the end of the seed.
> The array can then be converted by the NumberFactory without an exception.
> These routines should be updated to use the same method as NumberFactory to
> fill in a long[] and then add any trailing bytes to the final long.
> This avoids any array copy when using arbitrary seed lengths, e.g.
> SecureRandom.getSeed(13).
--
This message was sent by Atlassian Jira
(v8.20.1#820001)