##// END OF EJS Templates
rust-discovery: type alias for random generator seed...
Georges Racinet -
r44494:2abffea4 default
parent child Browse files
Show More
@@ -18,6 +18,7 b' use std::cmp::{max, min};'
18 use std::collections::{HashSet, VecDeque};
18 use std::collections::{HashSet, VecDeque};
19
19
20 type Rng = rand_pcg::Pcg32;
20 type Rng = rand_pcg::Pcg32;
21 type Seed = [u8; 16];
21
22
22 pub struct PartialDiscovery<G: Graph + Clone> {
23 pub struct PartialDiscovery<G: Graph + Clone> {
23 target_heads: Option<Vec<Revision>>,
24 target_heads: Option<Vec<Revision>>,
@@ -158,7 +159,7 b' impl<G: Graph + Clone> PartialDiscovery<'
158 respect_size: bool,
159 respect_size: bool,
159 randomize: bool,
160 randomize: bool,
160 ) -> Self {
161 ) -> Self {
161 let mut seed: [u8; 16] = [0; 16];
162 let mut seed = [0; 16];
162 if randomize {
163 if randomize {
163 thread_rng().fill_bytes(&mut seed);
164 thread_rng().fill_bytes(&mut seed);
164 }
165 }
@@ -168,7 +169,7 b' impl<G: Graph + Clone> PartialDiscovery<'
168 pub fn new_with_seed(
169 pub fn new_with_seed(
169 graph: G,
170 graph: G,
170 target_heads: Vec<Revision>,
171 target_heads: Vec<Revision>,
171 seed: [u8; 16],
172 seed: Seed,
172 respect_size: bool,
173 respect_size: bool,
173 randomize: bool,
174 randomize: bool,
174 ) -> Self {
175 ) -> Self {
General Comments 0
You need to be logged in to leave comments. Login now