File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
branches/try2/src/libstd/rand Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
5
5
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
- refs/heads/try2: a5bb0a3a4574af88add700ace7aefc37172fa7a5
8
+ refs/heads/try2: ff94f867d29a90ab59060c10a62f65994776a8c4
9
9
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
10
10
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
11
11
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -244,7 +244,7 @@ pub fn random<T: Rand>() -> T {
244
244
task_rng ( ) . gen ( )
245
245
}
246
246
247
- /// Randomly sample up to `n ` elements from an iterator.
247
+ /// Randomly sample up to `amount ` elements from an iterator.
248
248
///
249
249
/// # Example
250
250
///
@@ -257,11 +257,11 @@ pub fn random<T: Rand>() -> T {
257
257
/// ```
258
258
pub fn sample < T , I : Iterator < T > , R : Rng > ( rng : & mut R ,
259
259
mut iter : I ,
260
- amt : uint ) -> Vec < T > {
261
- let mut reservoir: Vec < T > = iter. by_ref ( ) . take ( amt ) . collect ( ) ;
260
+ amount : uint ) -> Vec < T > {
261
+ let mut reservoir: Vec < T > = iter. by_ref ( ) . take ( amount ) . collect ( ) ;
262
262
for ( i, elem) in iter. enumerate ( ) {
263
- let k = rng. gen_range ( 0 , i + 1 + amt ) ;
264
- if k < amt {
263
+ let k = rng. gen_range ( 0 , i + 1 + amount ) ;
264
+ if k < amount {
265
265
* reservoir. get_mut ( k) = elem;
266
266
}
267
267
}
You can’t perform that action at this time.
0 commit comments