File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
branches/snap-stage3/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 1
1
---
2
2
refs/heads/master: 1bff1ff810dcfa8064c11e2b84473f053d1f69f1
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
- refs/heads/snap-stage3: a5bb0a3a4574af88add700ace7aefc37172fa7a5
4
+ refs/heads/snap-stage3: ff94f867d29a90ab59060c10a62f65994776a8c4
5
5
refs/heads/try: 2e9d9477b848cec778ca3f07ecdf0aea6ade23de
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
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