Skip to content

Commit 4ef659e

Browse files
committed
From review: don't generate Random with same seed, just use a single instance
1 parent 383718e commit 4ef659e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/FSharp.Control.TaskSeq.SmokeTests/TestUtils.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ type µs
2424
/// Inspired by IoT code: https://github.com/dotnet/iot/pull/235/files
2525
module DelayHelper =
2626

27+
let private rnd = Random()
28+
2729
/// <summary>
2830
/// Delay for at least the specified <paramref name="microseconds"/>.
2931
/// </summary>
@@ -50,7 +52,6 @@ module DelayHelper =
5052
Thread.SpinWait(1)
5153

5254
let delayTask (µsecMin: int64<µs>) (µsecMax: int64<µs>) f = task {
53-
let rnd = Random()
5455
let rnd () = rnd.NextInt64(int64 µsecMin, int64 µsecMax) * 1L<µs>
5556

5657
// ensure unequal running lengths and points-in-time for assigning the variable

src/FSharp.Control.TaskSeq.Test/TestUtils.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ type µs
2424
/// Inspired by IoT code: https://github.com/dotnet/iot/pull/235/files
2525
module DelayHelper =
2626

27+
let private rnd = Random()
28+
2729
/// <summary>
2830
/// Delay for at least the specified <paramref name="microseconds"/>.
2931
/// </summary>
@@ -50,7 +52,6 @@ module DelayHelper =
5052
Thread.SpinWait(1)
5153

5254
let delayTask (µsecMin: int64<µs>) (µsecMax: int64<µs>) f = task {
53-
let rnd = Random()
5455
let rnd () = rnd.NextInt64(int64 µsecMin, int64 µsecMax) * 1L<µs>
5556

5657
// ensure unequal running lengths and points-in-time for assigning the variable

0 commit comments

Comments
 (0)