All releases of RandomKit adhere to Semantic Versioning.
v5.2.3 (2017-08-08)
- Fixed compilation errors Xcode 9 Beta 5
v5.2.2 (2017-07-28)
- Reimplement
String.UTF16Index
conformances toRandomInRange
andRandomInClosedRange
.
v5.2.1 (2017-07-28)
- Removed
String.UTF16Index
conformances toRandomInRange
andRandomInClosedRange
for Swift 3.2 and after- This was enabled by an implementation based on
Strideable
, which the type no longer conforms to as of Swift 3.2
- This was enabled by an implementation based on
v5.2.0 (2017-07-25)
- Made
Trivial
protocol public, allowing for library users to enable related optimizations for their own types - Added
jump(count:)
variant ofjump()
toXoroshiro
andXorshiftStar
- Made
jump()
forXorshiftStar
20%+ faster - Made
reseed(with:)
forChaCha
550%+ fasterinit(seed:)
is also faster due to reliance onreseed(with:)
v5.1.0 (2017-06-24)
- Initial Swift 4 compatibility 🎉
- Improved time to access a thread-local generator by ~22%
- Adds Threadly dependency
- The ShiftOperations package is not required for Swift 3.2 and above
v5.0.0 (2017-05-31)
- Added
RandomRetrievable
andRandomRetrievableInRange
protocols - Added
SeedableFromSequence
protocol
- Removed
random(using:)
method that applied to allSequence
types - Removed
Double
random(within:using:)
forTimeInterval
ranges - Renamed
RandomWithinRange
andRandomWithinClosedRange
toRandomInRange
andRandomInClosedRange
respectively- Functions that had a
within:
argument now usein:
- Functions that had a
SeedableFromRandomGenerator
no longer requiresSeedable
- Changed
ChaCha.Seed
to[UInt32]
v4.5.2 (2017-04-13)
- Fixed
Xoroshiro
jump method
v4.5.1 (2017-04-12)
ChaCha
reseed(with:)
did not generate the same values for the same seed it was instantiated with
v4.5.0 (2017-04-12)
- ChaCha random number generator
- Added
reseed()
method toSeedableFromOtherRandomGenerator
- Make random
Array
initializers 5-10% faster
v4.4.1 (2017-03-30)
- Safely accesses internal global thread-local-storage type keys dictionary with a readers-write lock
v4.4.0 (2017-03-30)
- Added initializers to
ReseedingRandomGenerator
that take 1 or 0 arguments- If
Reseeder
conforms toSeedableFromOtherRandomGenerator
, the reseeder is created fromReseeder.seeded
- For Swift >= 3.1, if
Reseeder
isDeviceRandom
orARC4Random
, the reseeder is justReseeder.default
- If
- Added floating-point value generation methods for open, half open, and closed intervals
- Added thread-local random generators 🎉
- Made
Double
andFloat
random(using:)
about 27 times faster - Made
CGFloat.random(using:)
faster , in turn making(NS|UI)Color.random(using:)
faster
- Made
randomClosed
methods be truly on the [0, 1] interval
v4.3.1 (2017-03-21)
- Random
Date
s are internally relative totimeIntervalSinceReferenceDate
- Deprecated
Date
random(within:using:)
forTimeInterval
ranges
v4.3.0 (2017-03-21)
- Added
SeedableFromOtherRandomGenerator
protocol- Allows for creating a
RandomGenerator
seeded from anotherRandomGenerator
- Allows for creating a
- Added
ReseedingRandomGenerator
struct for reseeding a baseRandomGenerator
with another after a certain number of bytes have been generated
- Much faster Array
random(using:)
for Swift versions before 3.1
- Fix compilation issues by not using API unavailable in Swift 3.1
v4.2.0 (2017-03-15)
-
Made Array
init(randomCount:using:)
about 4 times faster for integer types by having it safely callinit(unsafeRandomCount:using:)
-
Made Dictionary shuffling faster
- Made Array
init(unsafeRandomCount:using:)
available for all element types, regardless if they conform toUnsafeRandom
v4.1.0 (2017-03-15)
- Added
seeded
static variable toXoroshiro
,Xorshift
,XorshiftStar
, andMersenneTwister
- Made the
init(randomCount:using:)
family ofArray
initializers significantly faster
v4.0.0 (2017-03-06)
- Added
randoms(using:)
methods toRandom-
types that return a sequence of random values according to the protocol's specialization - Added
Bool.random(withWeight:using:)
for probability - Added more random number generators:
Xorshift
XorshiftStar
NSMutableArray
now conforms toShuffleable
andUniqueShuffleable
- Added
randomTuple(using:)
global functions for creating tuples of up to six random elements - Added
ShuffleableInRange
andUniqueShuffleableInRange
protocols
- Much better
init(randomCount:using:)
performance forArray
andDictionary
Array
shuffling is ten times faster- Much better performance for
random(within:using:)
for signed integers
- Changed
RandomGenerator
from an enum to a protocol type- As a result, there is no default generator, meaning a generator must be specified as a parameter
- Random generation functions take a generic
RandomGenerator
type as aninout
argument - Removed
URL
conformance toRandom
v3.0.0 (2016-12-09)
- Mersenne Twister random generator
- All integer types conform to
UnsafeRandom
Array(unsafeRandomCount:using:)
for types conforming toUnsafeRandom
- For much better performance with integer types, this should be used
- Added a benchmark target that can be built with the Swift package manager
- Created
RandomWithMaxWidth
andRandomWithExactWidth
protocols - Added
randomize(buffer:maxWidth:)
andrandomize(buffer:exactWidth:)
methods toRandomGenerator
- Generating
RandomEnum
values is significantly faster
UnicodeScalar
now produces a uniform distribution when theRange
orClosedRange
spans below0xD7FF
and above0xE000
- Removed
RandomDistribution
(#29) - The
devRandom
anddevURandom
cases forRandomGenerator
are now a singledevice
case with aDeviceSource
parameter - The
arc4random
case forRandomGenerator
is now camel-casedarc4Random
Float80
extension now available for i386 and x86_64 architectures, not only for macOSURL.random(fromValues:)
now returns anOptional<URL>
- Added ShiftOperations dependency
- Uses
Strideable
instead of_Strideable
v2.3.0 (2016-11-21)
Date
now conforms toRandomWithinRange
- Made unicode scalar based string generation faster
- Created
UnsafeRandom
,RandomEnum
,RandomWithAll
, andRandomRawRepresentable
protocols
- Fix which random generator is used for random String. Previously used the default instead of the one passed into the function.
v2.2.1 (2016-11-08)
- Conformance to
Random
was removed accidentally for types conforming toFloatingPoint
. This has been fixed.
v2.2.0 (2016-11-07)
- Random
Int
generation would rely on the size ofUIntMax
which was apparently not reliable (#28)
- If on Linux, Android, or Windows, the
arc4random_buf
function will be dynamically loaded, making theRandomGenerator.arc4random
option more widely available - Removed default parameter for
randomGenerator
for therandom(using:)
function ofRange
types - Removed
Random
protocol dependency fromRandom-
protocols
v2.1.0 (2016-10-29)
- Range types now have
random
andrandom(using:)
for when bounds areRandomWithinRange
andRandomWithinClosedRange
types - Improved performance for retrieving random elements from collections
- Fixed
random(within:)
for unsigned integers
v2.0.0 (2016-10-28)
- Swift 3 compatibility
- A bunch of protocols/types
v1.6.0 (2015-11-21)
randomGenerator()
andrandomSequence()
forRandomType
that return an infinite number of random values- New
ShuffleType
protocol for types that can return its values shuffled- Array and Dictionary can be shuffled
- New
RandomIntervalType
protocol that allows for getting a random value within a closed interval- Random generators and sequences can be made within a closed interval
- Getting random slices of an Array (Phi Mage #10)
- Deleted
String.RandomLength
andNSURL.RandomValues
v1.5.0 (2015-10-25)
- tvOS support 📺
- Added random generators to types in the CoreGraphics module as well as
NSNumber
- Removed the Foundation import for extensions of Swift types (only 'stdlib.h' is needed for arc4random)
- Relevant Objective-C types now conform to
RandomType
v1.4.0 (2015-10-17)
- Random phone number generator
- Random gender generator
- Random English honorific generator according to type and gender
- Another
CGFloat
random generator with interval parameter
- Faster
Double
,Float
, andCGFloat
generation CGFloat
value generation is now dependent on itsNativeType
v1.3.0 (2015-10-14)
- Added
random
property toSequenceType
that returns a random element, ornil
if the sequence is empty. - Added
random()
static method toBit
, that returnsOne
orZero
with a 50/50 chance of either.
v1.2.0 (2015-10-12)
- Random generators for
NSDate
andNSURL
have been added
- Parameter for
Color.random()
is now named #1
v1.1.0 (2015-10-12)
RandomType
protocol for types that can generate a random value ofSelf
.- Added a
random
property toCollectionType
that returns a random element ofself
, ornil
ifself
is empty String.RandomLength
for setting the default length used byString.random()
v1.0.0 (2015-10-11)
Initial release