You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the underlying random class is J2N.Randomizer, we need to cascade the calls to NextBoolean(), NextInt64() and NextSingle() to the underlying implementation.
Since there will eventually be another subclass of System.Random in this library in future versions of Lucene, we should do this by creating an interface in J2N so we can tell whether these methods are implemented (since they aren't prior to .NET 6.0). This will allow us to test for the presence of that interface and call the method only if it exists, falling back to our current implementation.
.NET 8 also introduces the Shuffle method on the Random class. In J2N, it exists in ListExtensions. We should add the implementation to the Randomizer class and also fix the existing Shuffle method to cascade the call to Randomizer after checking for its interface.
When the underlying random class is J2N.Randomizer, we need to cascade the calls to
NextBoolean()
,NextInt64()
andNextSingle()
to the underlying implementation.Since there will eventually be another subclass of
System.Random
in this library in future versions of Lucene, we should do this by creating an interface in J2N so we can tell whether these methods are implemented (since they aren't prior to .NET 6.0). This will allow us to test for the presence of that interface and call the method only if it exists, falling back to our current implementation..NET 8 also introduces the Shuffle method on the Random class. In J2N, it exists in ListExtensions. We should add the implementation to the
Randomizer
class and also fix the existingShuffle
method to cascade the call toRandomizer
after checking for its interface.Proposed Interfaces
The
NextInt64()
method overloads can also be optimized by using an array pool, since the byte array is only a temporary buffer.The text was updated successfully, but these errors were encountered: