-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: run simulator with optional fixed seed
What this commit does: - Makes it possible to run the simulator with an optional u64 fixed-seed for deterministic outcomes for randomly generated payment activities Notes: - This commit defines SeededRng: a thread-safe, mutually exclusive option of any type that implements RngCore and Send. - SeededRng is a field in both NetworkGraphView and RandomPaymentActivity. Both the DestinationGenerator and PaymentGenerator hold references to SeededRng in their trait implementations. If SeededRng is defined as an Option<Box<dyn RngCore + Send>>, it will be impossible to gain exclusive access (&mut) to self.seeded_rng, which is shared access (&). Mutable reference to the SeededRng is required by the distribution samplers. - Thus, SeededRng as previously defined (Option<Box<dyn RngCore + Send>>) is wrapped in Arc<Mutex<>> for exclusive access.
- Loading branch information
Showing
6 changed files
with
107 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,4 @@ mockall = "0.12.1" | |
rand_chacha = "0.3.1" | ||
|
||
[dev-dependencies] | ||
ntest = "0.9.0" | ||
ntest = "0.9.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.