Update users for the std::rand -> librand move.

This commit is contained in:
Huon Wilson 2014-03-02 11:33:24 +11:00
parent 15e2898462
commit 198caa87cd
70 changed files with 131 additions and 64 deletions

View File

@ -50,13 +50,13 @@ concurrency at this writing:
* [`sync::DuplexStream`] - An extension of `pipes::stream` that allows both sending and receiving,
* [`sync::SyncChan`] - An extension of `pipes::stream` that provides synchronous message sending,
* [`sync::SyncPort`] - An extension of `pipes::stream` that acknowledges each message received,
* [`sync::rendezvous`] - Creates a stream whose channel, upon sending a message, blocks until the
* [`sync::rendezvous`] - Creates a stream whose channel, upon sending a message, blocks until the
message is received.
* [`sync::Arc`] - The Arc (atomically reference counted) type, for safely sharing immutable data,
* [`sync::RWArc`] - A dual-mode Arc protected by a reader-writer lock,
* [`sync::MutexArc`] - An Arc with mutable data protected by a blocking mutex,
* [`sync::Semaphore`] - A counting, blocking, bounded-waiting semaphore,
* [`sync::Mutex`] - A blocking, bounded-waiting, mutual exclusion lock with an associated
* [`sync::Mutex`] - A blocking, bounded-waiting, mutual exclusion lock with an associated
FIFO condition variable,
* [`sync::RWLock`] - A blocking, no-starvation, reader-writer lock with an associated condvar,
* [`sync::Barrier`] - A barrier enables multiple tasks to synchronize the beginning
@ -343,8 +343,8 @@ a single large vector of floats. Each task needs the full vector to perform its
~~~
# extern crate sync;
extern crate rand;
# use std::vec;
# use std::rand;
use sync::Arc;
fn pnorm(nums: &~[f64], p: uint) -> f64 {
@ -376,9 +376,9 @@ created by the line
~~~
# extern crate sync;
# extern crate rand;
# use sync::Arc;
# use std::vec;
# use std::rand;
# fn main() {
# let numbers = vec::from_fn(1000000, |_| rand::random::<f64>());
let numbers_arc=Arc::new(numbers);
@ -389,9 +389,9 @@ and a clone of it is sent to each task
~~~
# extern crate sync;
# extern crate rand;
# use sync::Arc;
# use std::vec;
# use std::rand;
# fn main() {
# let numbers=vec::from_fn(1000000, |_| rand::random::<f64>());
# let numbers_arc = Arc::new(numbers);
@ -406,9 +406,9 @@ Each task recovers the underlying data by
~~~
# extern crate sync;
# extern crate rand;
# use sync::Arc;
# use std::vec;
# use std::rand;
# fn main() {
# let numbers=vec::from_fn(1000000, |_| rand::random::<f64>());
# let numbers_arc=Arc::new(numbers);

View File

@ -2529,7 +2529,7 @@ of type `ABC` can be randomly generated and converted to a string:
#[deriving(Eq)]
struct Circle { radius: f64 }
#[deriving(Rand, Show)]
#[deriving(Clone, Show)]
enum ABC { A, B, C }
~~~

View File

@ -39,6 +39,7 @@ TEMPLATE = """// Copyright {year} The Rust Project Developers. See the COPYRIGHT
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
{error_deriving}
struct Error;

View File

@ -947,8 +947,8 @@ mod tests {
use std::uint;
use std::vec;
use std::rand;
use std::rand::Rng;
use rand;
use rand::Rng;
static BENCH_BITS : uint = 1 << 14;

View File

@ -44,8 +44,9 @@ pub mod bench {
extern crate test;
use self::test::BenchHarness;
use std::container::MutableMap;
use std::{vec, rand};
use std::rand::Rng;
use std::vec;
use rand;
use rand::Rng;
pub fn insert_rand_n<M:MutableMap<uint,uint>>(n: uint,
map: &mut M,

View File

@ -633,7 +633,7 @@ mod tests {
extern crate test;
use self::test::BenchHarness;
use deque::Deque;
use std::rand;
use rand;
use super::{DList, Node, ListInsertion};
pub fn check_links<T>(list: &DList<T>) {

View File

@ -61,8 +61,8 @@ use std::iter::{FilterMap, Chain, Repeat, Zip};
use std::iter;
use std::mem::replace;
use std::num;
use std::rand::Rng;
use std::rand;
use rand::Rng;
use rand;
use std::vec::{Items, MutItems};
use std::vec_ng::Vec;
use std::vec_ng;

View File

@ -23,6 +23,8 @@
#[allow(unrecognized_lint)];
#[allow(default_type_param_usage)];
extern crate rand;
#[cfg(test)] extern crate test;
pub use bitv::Bitv;

View File

@ -1009,8 +1009,8 @@ mod test_treemap {
use super::{TreeMap, TreeNode};
use std::rand::Rng;
use std::rand;
use rand::Rng;
use rand;
#[test]
fn find_empty() {

View File

@ -898,7 +898,7 @@ mod test_map {
mod bench_map {
extern crate test;
use super::TrieMap;
use std::rand::{weak_rng, Rng};
use rand::{weak_rng, Rng};
use self::test::BenchHarness;
#[bench]

View File

@ -34,9 +34,10 @@ Rust extras are part of the standard Rust distribution.
#[deny(non_camel_case_types)];
#[deny(missing_doc)];
extern crate sync;
extern crate serialize;
extern crate collections;
extern crate rand;
extern crate serialize;
extern crate sync;
extern crate time;
// Utility modules

View File

@ -12,8 +12,8 @@
use std::os;
use std::rand::Rng;
use std::rand;
use rand::Rng;
use rand;
use std::io;
use std::io::fs;

View File

@ -90,9 +90,10 @@ pub fn inflate_bytes_zlib(bytes: &[u8]) -> CVec<u8> {
#[cfg(test)]
mod tests {
extern crate rand;
use super::{inflate_bytes, deflate_bytes};
use std::rand;
use std::rand::Rng;
use self::rand::Rng;
#[test]
fn test_flate_round_trip() {

View File

@ -175,6 +175,8 @@
#[feature(macro_rules)];
#[allow(visible_private_types)];
extern crate rand;
use std::mem::replace;
use std::os;
use std::rt::crate_map;

View File

@ -9,7 +9,6 @@
// except according to those terms.
use std::cast;
use std::rand::{XorShiftRng, Rng, Rand};
use std::rt::local::Local;
use std::rt::rtio::{RemoteCallback, PausableIdleCallback, Callback, EventLoop};
use std::rt::task::BlockedTask;
@ -18,6 +17,8 @@ use std::sync::deque;
use std::unstable::mutex::NativeMutex;
use std::raw;
use rand::{XorShiftRng, Rng, Rand};
use TaskState;
use context::Context;
use coroutine::Coroutine;
@ -957,7 +958,7 @@ fn new_sched_rng() -> XorShiftRng {
fn new_sched_rng() -> XorShiftRng {
use std::libc;
use std::mem;
use std::rand::SeedableRng;
use rand::SeedableRng;
let fd = "/dev/urandom".with_c_str(|name| {
unsafe { libc::open(name, libc::O_RDONLY, 0) }

View File

@ -24,7 +24,7 @@ use std::from_str::FromStr;
use std::num::CheckedDiv;
use std::num::{Bitwise, ToPrimitive, FromPrimitive};
use std::num::{Zero, One, ToStrRadix, FromStrRadix};
use std::rand::Rng;
use rand::Rng;
use std::str;
use std::uint;
use std::vec;
@ -1470,7 +1470,7 @@ mod biguint_tests {
use std::num::{Zero, One, FromStrRadix, ToStrRadix};
use std::num::{ToPrimitive, FromPrimitive};
use std::num::CheckedDiv;
use std::rand::{task_rng};
use rand::{task_rng};
use std::str;
use std::u64;
use std::vec;
@ -2205,7 +2205,7 @@ mod bigint_tests {
use std::num::CheckedDiv;
use std::num::{Zero, One, FromStrRadix, ToStrRadix};
use std::num::{ToPrimitive, FromPrimitive};
use std::rand::{task_rng};
use rand::{task_rng};
use std::u64;
#[test]

View File

@ -15,6 +15,8 @@
#[crate_type = "dylib"];
#[license = "MIT/ASL2"];
extern crate rand;
pub mod bigint;
pub mod rational;
pub mod complex;

View File

@ -524,12 +524,14 @@ static H256: [u32, ..8] = [
#[cfg(test)]
mod tests {
extern crate rand;
use super::{Digest, Sha256, FixedBuffer};
use std::num::Bounded;
use std::vec;
use std::vec_ng::Vec;
use std::rand::isaac::IsaacRng;
use std::rand::Rng;
use self::rand::isaac::IsaacRng;
use self::rand::Rng;
use serialize::hex::FromHex;
// A normal addition - no overflow occurs

View File

@ -263,6 +263,7 @@ impl<'a> FromBase64 for &'a str {
#[cfg(test)]
mod tests {
extern crate test;
extern crate rand;
use self::test::BenchHarness;
use base64::{Config, FromBase64, ToBase64, STANDARD, URL_SAFE};
@ -335,7 +336,7 @@ mod tests {
#[test]
fn test_base64_random() {
use std::rand::{task_rng, random, Rng};
use self::rand::{task_rng, random, Rng};
use std::vec;
for _ in range(0, 1000) {

View File

@ -18,23 +18,27 @@
* With simple pipes, without Arc, a copy would have to be made for each task.
*
* ```rust
* extern crate sync;
* extern crate rand;
* use sync::Arc;
* use std::{rand, vec};
* use std::vec;
*
* let numbers = vec::from_fn(100, |i| (i as f32) * rand::random());
* let shared_numbers = Arc::new(numbers);
* fn main() {
* let numbers = vec::from_fn(100, |i| (i as f32) * rand::random());
* let shared_numbers = Arc::new(numbers);
*
* for _ in range(0, 10) {
* let (port, chan) = Chan::new();
* chan.send(shared_numbers.clone());
* for _ in range(0, 10) {
* let (port, chan) = Chan::new();
* chan.send(shared_numbers.clone());
*
* spawn(proc() {
* let shared_numbers = port.recv();
* let local_numbers = shared_numbers.get();
* spawn(proc() {
* let shared_numbers = port.recv();
* let local_numbers = shared_numbers.get();
*
* // Work with the local numbers
* });
* }
* // Work with the local numbers
* });
* }
* }
* ```
*/

View File

@ -216,7 +216,7 @@ pub struct TraitDef<'a> {
pub struct MethodDef<'a> {
/// name of the method
name: &'a str,
/// List of generics, e.g. `R: std::rand::Rng`
/// List of generics, e.g. `R: rand::Rng`
generics: LifetimeBounds<'a>,
/// Whether there is a self argument (outer Option) i.e. whether

View File

@ -62,6 +62,8 @@ Examples of string representations:
// test harness access
#[cfg(test)]
extern crate test;
extern crate rand;
extern crate serialize;
use std::cast::{transmute,transmute_copy};
@ -71,11 +73,11 @@ use std::fmt;
use std::from_str::FromStr;
use std::hash::{Hash, sip};
use std::num::FromStrRadix;
use std::rand::Rng;
use std::rand;
use std::str;
use std::vec;
use rand::Rng;
use serialize::{Encoder, Encodable, Decoder, Decodable};
/// A 128-bit (16 byte) buffer containing the ID
@ -519,12 +521,12 @@ impl rand::Rand for Uuid {
#[cfg(test)]
mod test {
extern crate collections;
extern crate rand;
use super::{Uuid, VariantMicrosoft, VariantNCS, VariantRFC4122,
Version1Mac, Version2Dce, Version3Md5, Version4Random,
Version5Sha1};
use std::str;
use std::rand;
use std::io::MemWriter;
#[test]

View File

@ -9,11 +9,12 @@
// except according to those terms.
extern crate collections;
extern crate rand;
extern crate time;
use collections::{TrieMap, TreeMap, HashMap, HashSet};
use std::os;
use std::rand::{Rng, IsaacRng, SeedableRng};
use rand::{Rng, IsaacRng, SeedableRng};
use std::uint;
use std::vec;

View File

@ -11,13 +11,13 @@
// except according to those terms.
extern crate collections;
extern crate rand;
extern crate time;
use collections::bitv::BitvSet;
use collections::TreeSet;
use collections::HashSet;
use std::os;
use std::rand;
use std::uint;
struct Results {

View File

@ -12,13 +12,13 @@
#[feature(macro_rules)];
extern crate rand;
extern crate time;
use time::precise_time_s;
use rand::Rng;
use std::mem::swap;
use std::os;
use std::rand::Rng;
use std::rand;
use std::str;
use std::vec;
use std::io::File;

View File

@ -11,8 +11,10 @@
// Multi-language Perlin noise benchmark.
// See https://github.com/nsf/pnoise for timings and alternative implementations.
extern crate rand;
use std::f32::consts::PI;
use std::rand::{Rng, StdRng};
use rand::{Rng, StdRng};
struct Vec2 {
x: f32,

View File

@ -19,4 +19,3 @@ fn g<T:'static>(x: T) -> @T {
}
fn main() {}

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,8 +12,8 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
use std::hash::Hash;
struct Error;

View File

@ -12,8 +12,8 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
use std::hash::Hash;
struct Error;

View File

@ -12,8 +12,8 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
use std::hash::Hash;
struct Error;

View File

@ -12,8 +12,8 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
use std::hash::Hash;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq, Ord, TotalEq)]
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq, Ord, TotalEq)]
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq, Ord, TotalEq)]
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq, Ord, TotalEq)]
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -12,6 +12,7 @@
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
struct Error;

View File

@ -8,8 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate rand;
use rand::{task_rng, Rng};
use std::{char, os, str};
use std::rand::{task_rng, Rng};
use std::io::{File, Process};
// creates unicode_input_multiple_files_{main,chars}.rs, where the

View File

@ -8,8 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate rand;
use rand::{task_rng, Rng};
use std::{char, os, str};
use std::rand::{task_rng, Rng};
use std::io::{File, Process};
// creates a file with `fn main() { <random ident> }` and checks the

View File

@ -16,10 +16,11 @@
#[feature(struct_variant, managed_boxes)];
extern crate rand;
extern crate serialize;
use std::io::MemWriter;
use std::rand::{random, Rand};
use rand::{random, Rand};
use serialize::{Encodable, Decodable};
use serialize::ebml;
use serialize::ebml::writer::Encoder;

View File

@ -22,6 +22,8 @@
// except according to those terms.
extern crate serialize; // {En,De}codable
extern crate rand; // Rand
mod submod {
// if any of these are implemented without global calls for any
// function calls, then being in a submodule will (correctly)

View File

@ -9,9 +9,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-fast #7103 `extern crate` does not work on check-fast
#[feature(struct_variant)];
use std::rand;
extern crate rand;
#[deriving(Rand)]
struct A;

View File

@ -13,7 +13,8 @@
// This test attempts to force the dynamic linker to resolve
// external symbols as close to the red zone as possible.
use std::rand;
extern crate rand;
use std::task;
mod rustrt {
@ -59,7 +60,7 @@ fn runtest2(f: extern fn(), frame_backoff: u32, last_stk: *u8) -> u32 {
}
pub fn main() {
use std::rand::Rng;
use rand::Rng;
let fns = ~[
calllink01,
calllink02,

View File

@ -8,8 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-fast #7103 `extern crate` does not work on check-fast
extern crate rand;
use std::task;
use std::rand::{task_rng, Rng};
use rand::{task_rng, Rng};
static MAX_LEN: uint = 20;
static mut drop_counts: [uint, .. MAX_LEN] = [0, .. MAX_LEN];