You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alex Herbert (Jira)" <ji...@apache.org> on 2022/09/19 19:14:00 UTC

[jira] [Resolved] (RNG-169) Update array seed conversion to use optimum seed length

     [ https://issues.apache.org/jira/browse/RNG-169?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Herbert resolved RNG-169.
------------------------------
    Resolution: Implemented

> 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.10#820010)