RandN v0.2.0 has been released! It's available at NuGet and GitHub. Highlights of this release include:
ChaChais now SIMD accerated and has between 6x-11x higher throughput on CPUs supporting AVX2 on .NET Core 3.1 and 5+ compared to .NET Framework 4.7.2.
RandN.Distributionsnamespace has been reworked significantly to make discovery and usage easier.
- Comprehensive unit test coverage.
- Many bugs found and fixed thanks to improved testing.
- This fancy documentation website!
A full list of changes, including breaking changes from v0.1 to v0.2, is included further below.
More distributions and more RNG algorithms - whether or not these will be included alongside
RandN's primary NuGet package or on another is still TBD.
More efficient one-off range distribution - right now, an entire
Uniform object must be built before sampling a range; this could make some use cases, such as the
RandomShim, much more efficient.
Improvements to website versioning - only the Docs and API need to be versioned, not the blog or the index page.
- The marker-interface IPortableDistribution
has been created to mark distributions that provide portable and repeatable results across all platforms. Currently, the Bernoulli, the uniform
Decimal, the uniform
TimeSpan, and all the uniform integer distributions are portable.
- Added BlockBuffer32<TBlockRng, TBlockCounter>.BlockLength for consistency with BlockBuffer32
- Uniform distributions now live have been grouped into nested classes under the Uniform static class. For example,
UniformInt32has become Uniform.Int32.
- Unit interval distributions now live in the Rand.Distributions.UnitInterval namespace and have been grouped into nested classes. For example,
UnitInterval.OpenDoublehas become UnitInterval.Open.Double.
- Method arguments now have null-checks injected by NullGuard.Fody instead of relying on the honor system.
TRngtype parameter of IRngFactory
and IReproducibleRngFactory<TRng, TSeed> is now covariant (
BlockBuffer32<TBlockRng>.Lengthhas been renamed to
- Removed the
Sampleextension methods - these were questionably useful, and could be up to four times slower than their non-extension counterpart, IDistribution.Sample.
- Distributions returning floating point numbers would sometimes sample a number outside the desired range on .NET Framework x86, which can use 80-bit floating point calculations, instead of 64-bit. Results are now forced to 64-bit precision before returning.
BitwiseExtensions.RotateRightnow rotates bits right instead of left on .NET Core 3.1+.
- All places where overflow is expected is now wrapped with
- Full test coverage, excluding portions that can't be tested without a big-endian processor.
- Pure methods and properties in
RandN.Corehave been marked with the [Pure] attribute.
- Use of C# 9 features across the board where possible.
- Fixed a bunch of things suggested by ReSharper.
- More benchmarks have been added.