Skip to content

Commit 69c7174

Browse files
committed
---
yaml --- r: 22572 b: refs/heads/master c: db34b5a h: refs/heads/master v: v3
1 parent 4518668 commit 69c7174

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 0e42004babc7b965a10056084a8ae76c72140a44
2+
refs/heads/master: db34b5acd150d114f392c907fa28f92a5227d3db
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/libcore/rand.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,22 @@ impl extensions for rng {
9494
(self.next() as u64 << 32) | self.next() as u64
9595
}
9696

97-
/// Return a random float
97+
/// Return a random float in the interval [0,1]
9898
fn gen_float() -> float {
9999
self.gen_f64() as float
100100
}
101101

102-
/// Return a random f32
102+
/// Return a random f32 in the interval [0,1]
103103
fn gen_f32() -> f32 {
104104
self.gen_f64() as f32
105105
}
106106

107-
/// Return a random f64
107+
/// Return a random f64 in the interval [0,1]
108108
fn gen_f64() -> f64 {
109109
let u1 = self.next() as f64;
110110
let u2 = self.next() as f64;
111111
let u3 = self.next() as f64;
112-
let scale = u32::max_value as f64;
112+
const scale : f64 = (u32::max_value as f64) + 1.0f64;
113113
ret ((u1 / scale + u2) / scale + u3) / scale;
114114
}
115115

0 commit comments

Comments
 (0)