add comment explaining arbitrary gen for uint
This commit is contained in:
parent
c3624193af
commit
37aabc3b6b
|
@ -1372,11 +1372,16 @@ macro_rules! impl_quickcheck_arbitrary_for_uint {
|
|||
let mut res = [0u8; $n_bytes];
|
||||
|
||||
let p = g.next_f64();
|
||||
// make it more likely to generate smaller numbers that
|
||||
// don't use up the full $n_bytes
|
||||
let range =
|
||||
// 10% chance to generate number that uses up to $n_bytes
|
||||
if p < 0.1 {
|
||||
$n_bytes
|
||||
// 20% chance to generate number that uses up to $n_bytes / 2
|
||||
} else if p < 0.2 {
|
||||
$n_bytes / 2
|
||||
// 70% chance to generate number that uses up to $n_bytes / 5
|
||||
} else {
|
||||
$n_bytes / 5
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue