fix some examples in std::rand::Rng

This commit is contained in:
flo-l 2013-10-04 16:38:05 +02:00
parent dfe29e2211
commit bf6b198c7e

View File

@ -259,9 +259,10 @@ pub trait Rng {
///
/// ```rust
/// use std::rand;
/// use std::rand::Rng;
///
/// fn main() {
/// let rng = rand::task_rng();
/// let mut rng = rand::task_rng();
/// let x: uint = rng.gen();
/// println!("{}", x);
/// println!("{:?}", rng.gen::<(f64, bool)>());
@ -278,9 +279,10 @@ pub trait Rng {
///
/// ```rust
/// use std::rand;
/// use std::rand::Rng;
///
/// fn main() {
/// let rng = rand::task_rng();
/// let mut rng = rand::task_rng();
/// let x: ~[uint] = rng.gen_vec(10);
/// println!("{:?}", x);
/// println!("{:?}", rng.gen_vec::<(f64, bool)>(5));
@ -303,12 +305,13 @@ pub trait Rng {
///
/// ```rust
/// use std::rand;
/// use std::rand::Rng;
///
/// fn main() {
/// let rng = rand::task_rng();
/// let mut rng = rand::task_rng();
/// let n: uint = rng.gen_integer_range(0u, 10);
/// println!("{}", n);
/// let m: i16 = rng.gen_integer_range(-40, 400);
/// let m: int = rng.gen_integer_range(-40, 400);
/// println!("{}", m);
/// }
/// ```
@ -348,6 +351,7 @@ pub trait Rng {
///
/// ```rust
/// use std::rand;
/// use std::rand::Rng;
///
/// fn main() {
/// println(rand::task_rng().gen_ascii_str(10));
@ -376,6 +380,7 @@ pub trait Rng {
///
/// ```rust
/// use std::rand;
/// use std::rand::Rng;
///
/// fn main() {
/// println!("{:?}", rand::task_rng().choose_option([1,2,4,8,16,32]));
@ -481,6 +486,7 @@ pub trait Rng {
///
/// ```rust
/// use std::rand;
/// use std::rand::Rng;
///
/// fn main() {
/// println!("{:?}", rand::task_rng().shuffle(~[1,2,3]));
@ -498,9 +504,10 @@ pub trait Rng {
///
/// ```rust
/// use std::rand;
/// use std::rand::Rng;
///
/// fn main() {
/// let rng = rand::task_rng();
/// let mut rng = rand::task_rng();
/// let mut y = [1,2,3];
/// rng.shuffle_mut(y);
/// println!("{:?}", y);
@ -524,9 +531,10 @@ pub trait Rng {
///
/// ```rust
/// use std::rand;
/// use std::rand::Rng;
///
/// fn main() {
/// let rng = rand::task_rng();
/// let mut rng = rand::task_rng();
/// let sample = rng.sample(range(1, 100), 5);
/// println!("{:?}", sample);
/// }