1.3.0
The final planned release of the 1.x line. It backports the features and critical fixes
from the upcoming 2.0 and deprecates every API that 2.0 removes, so migrating is mostly
a matter of following compiler warnings.
Fixed
AnyRandomGeneratornever advanced the caller's RNG. Erased generators — including
the built-innumber,uppercaseLetter,lowercaseLetterandcharacter(in:)
presets — replayed the same value forever under a seeded RNG. Seeded sequences that
involve erased generators will change with this fix; the first draw is unaffected.Zip(...).map { a, b, c in }failed to compile on Swift 6.3 (pack-expansion tuples are
no longer destructured into multi-parameter closures). Amapoverload onZipthat
receives the values as separate arguments restores the spelling, and CI now also builds
with the current Xcode toolchain and the latest Swift Linux image.IPAddressGeneratorimports Foundation explicitly (required under
MemberImportVisibility).Shuffledno longer requiresElement.Element: Equatable; shuffling never compares
elements.
Added
RandomGenerators.Bernoulli/.bool(probability:)— biased coin.orNil(probability:)— produce nil with a given probability.RandomGenerators.Normal(Box–Muller) andRandomGenerators.Exponentialdistribution
generators, with.normal(mean:standardDeviation:)/.exponential(rate:)sugar.RandomGenerators.oneOf(...)— uniform pick across 2–4 generators of different
concrete types sharing an element type.RandomGenerators.string(of:count:)andcharacterGen.string(count:)— build strings
directly from a character generator.- Seeded RNGs:
Xoshiro256(xoshiro256++),SplitMix64, andPCG(with independent
streams viasequence:).LCRNGdocuments its statistical weakness and points
simulations at these. RandomGenerators.frequency(_:)static factory (the 2.0 spelling).BoolGeneratortypealias (the 2.0 name forBoolRandomGenerator).
Deprecated (removed in 2.0)
ZipArrayGenerator,zipAll(),zipGenerators(...)→ use[generators].collect().gen.always(_:)→ constructAlways(_:)directly (the receiver was ignored).gen.colorGenerator(alpha:)→ constructColorGenerator(alpha:)directly.gen.frequency(_:)→RandomGenerators.frequency(_:)(the receiver was never part of
the distribution).gen.character(in:)/gen.unicodeScalar(in:)→RandomGenerators.character(in:)
(the upstream generator was ignored).uiColor(alpha:using:)/swiftUIColor(alpha:using:)→uiColor(using:)/
swiftUIColor(using:)(the alpha parameter was silently ignored; set alpha at
initialization).CreditCardGenerator.Generated→Element.