Skip to content

Commit

Permalink
Mention reason for interval choise
Browse files Browse the repository at this point in the history
  • Loading branch information
Pazzaz committed Jun 20, 2018
1 parent 0b1061a commit 02a7a11
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/distributions/other.rs
Expand Up @@ -50,7 +50,10 @@ impl Distribution<char> for Standard {
// reserved for surrogates. This is the size of that gap.
const GAP_SIZE: u32 = 0xDFFF - 0xD800 + 1;

// Uniform::new(0, 0x11_0000 - GAP_SIZE) can also be used but it
// seemed slower.
let range = Uniform::new(GAP_SIZE, 0x11_0000);

let mut n = range.sample(rng);
if n <= 0xDFFF {
n -= GAP_SIZE;
Expand Down

0 comments on commit 02a7a11

Please sign in to comment.