Skip to content

Commit fde9567

Browse files
author
Rohit Joshi
committed
2 parents 2f706a6 + e859922 commit fde9567

File tree

4 files changed

+692
-347
lines changed

4 files changed

+692
-347
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ A [separate changelog is kept for rand_core](rand_core/CHANGELOG.md).
99
You may also find the [Update Guide](UPDATING.md) useful.
1010

1111

12+
## [0.5.1] - Unreleased
13+
14+
### Platform support and `OsRng`
15+
- Remove blanket Unix implementation. (#484)
16+
- Remove Wasm unimplemented stub. (#484)
17+
- Dragonfly BSD: read from `/dev/random`. (#484)
18+
- Bitrig: use `getentropy` like OpenBSD. (#484)
19+
- Solaris: (untested) use `getrandom` if available, otherwise `/dev/random`. (#484)
20+
- Emscripten, `stdweb`: split the read up in chunks. (#484)
21+
- Emscripten, Haiku: don't do an extra blocking read from `/dev/random`. (#484)
22+
- Linux, NetBSD, Solaris: read in blocking mode on first use in `fill_bytes`. (#484)
23+
- Fuchsia, CloudABI: fix compilation (broken in Rand 0.5). (#484)
24+
1225
## [0.5.0] - 2018-05-21
1326

1427
### Crate features and organisation

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,16 @@ Rand release if required, but the change must be noted in the changelog.
108108

109109
## Crate Features
110110

111-
Rand is built with only the `std` feature anabled by default. The following
111+
Rand is built with only the `std` feature enabled by default. The following
112112
optional features are available:
113113

114114
- `alloc` can be used instead of `std` to provide `Vec` and `Box`.
115115
- `i128_support` enables support for generating `u128` and `i128` values.
116116
- `log` enables some logging via the `log` crate.
117117
- `nightly` enables all unstable features (`i128_support`).
118118
- `serde1` enables serialization for some types, via Serde version 1.
119-
- `stdweb` enables support for `OsRng` on WASM via stdweb.
119+
- `stdweb` enables support for `OsRng` on `wasm-unknown-unknown` via `stdweb`
120+
combined with `cargo-web`.
120121

121122
`no_std` mode is activated by setting `default-features = false`; this removes
122123
functionality depending on `std`:

src/distributions/cauchy.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,9 @@ impl Cauchy {
5050
impl Distribution<f64> for Cauchy {
5151
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> f64 {
5252
// sample from [0, 1)
53-
let mut x = rng.gen::<f64>();
54-
// guard against the extremely unlikely case we get the invalid 0.5
55-
while x == 0.5 {
56-
x = rng.gen::<f64>();
57-
}
53+
let x = rng.gen::<f64>();
5854
// get standard cauchy random number
55+
// note that π/2 is not exactly representable, even if x=0.5 the result is finite
5956
let comp_dev = (PI * x).tan();
6057
// shift and scale according to parameters
6158
let result = self.median + self.scale * comp_dev;

0 commit comments

Comments
 (0)