Skip to content

Commit 9dea13f

Browse files
Prachi Gauriarprachigauriar
authored andcommitted
Use randomPrintable(in:using:) to generate time intervals
1 parent ce2beac commit 9dea13f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# DevTesting Changelog
22

3+
## 1.5.0: October 22, 2025
4+
5+
The `Date.random(in:using:)` functions now use `BinaryFloatingPoint.randomPrintable(in:using:)` to
6+
generate time intervals. This should lead to greater reliability when converting the time intervals
7+
of generated dates into strings.
8+
9+
310
## 1.4.0: October 12, 2025
411

512
`Stub` and `ThrowingStub` now conform to `Observable`. The only property that is tracked is

Sources/DevTesting/Random Value Generation/Date+Random.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extension Date {
2121
let lowerBound = range.lowerBound.timeIntervalSinceReferenceDate
2222
let upperBound = range.upperBound.timeIntervalSinceReferenceDate
2323
return Date(
24-
timeIntervalSinceReferenceDate: .random(
24+
timeIntervalSinceReferenceDate: .randomPrintable(
2525
in: lowerBound ..< upperBound,
2626
using: &generator
2727
)
@@ -42,7 +42,7 @@ extension Date {
4242
let lowerBound = range.lowerBound.timeIntervalSinceReferenceDate
4343
let upperBound = range.upperBound.timeIntervalSinceReferenceDate
4444
return Date(
45-
timeIntervalSinceReferenceDate: .random(
45+
timeIntervalSinceReferenceDate: .randomPrintable(
4646
in: lowerBound ... upperBound,
4747
using: &generator
4848
)

0 commit comments

Comments
 (0)