* [`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
~~~
# extern crate sync;
+ extern crate rand;
# use std::vec;
-# use std::rand;
use sync::Arc;
fn pnorm(nums: &~[f64], p: uint) -> f64 {
~~~
# 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);
~~~
# 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);
~~~
# 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);
#[deriving(Eq)]
struct Circle { radius: f64 }
-#[deriving(Rand, Show)]
+#[deriving(Clone, Show)]
enum ABC { A, B, C }
~~~
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
{error_deriving}
struct Error;
use std::uint;
use std::vec;
- use std::rand;
- use std::rand::Rng;
+ use rand;
+ use rand::Rng;
static BENCH_BITS : uint = 1 << 14;
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,
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>) {
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;
#[allow(unrecognized_lint)];
#[allow(default_type_param_usage)];
+extern crate rand;
+
#[cfg(test)] extern crate test;
pub use bitv::Bitv;
use super::{TreeMap, TreeNode};
- use std::rand::Rng;
- use std::rand;
+ use rand::Rng;
+ use rand;
#[test]
fn find_empty() {
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]
#[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
use std::os;
-use std::rand::Rng;
-use std::rand;
+use rand::Rng;
+use rand;
use std::io;
use std::io::fs;
#[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() {
#[feature(macro_rules)];
#[allow(visible_private_types)];
+extern crate rand;
+
use std::mem::replace;
use std::os;
use std::rt::crate_map;
// 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;
use std::unstable::mutex::NativeMutex;
use std::raw;
+use rand::{XorShiftRng, Rng, Rand};
+
use TaskState;
use context::Context;
use coroutine::Coroutine;
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) }
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;
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;
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]
#[crate_type = "dylib"];
#[license = "MIT/ASL2"];
+extern crate rand;
+
pub mod bigint;
pub mod rational;
pub mod complex;
#[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
#[cfg(test)]
mod tests {
extern crate test;
+ extern crate rand;
use self::test::BenchHarness;
use base64::{Config, FromBase64, ToBase64, STANDARD, URL_SAFE};
#[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) {
* 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
+ * });
+ * }
+ * }
* ```
*/
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
// test harness access
#[cfg(test)]
extern crate test;
+
+extern crate rand;
extern crate serialize;
use std::cast::{transmute,transmute_copy};
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
#[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]
// 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;
// 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 {
#[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;
// 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,
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
-use std::hash::Hash;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
-use std::hash::Hash;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
-use std::hash::Hash;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
-use std::hash::Hash;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
#[deriving(Eq)]
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
#[deriving(Eq)]
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
#[deriving(Eq)]
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
#[deriving(Eq)]
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
#[deriving(Eq)]
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
#[deriving(Eq)]
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
#[deriving(Eq)]
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
#[deriving(Eq)]
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
#[deriving(Eq, Ord, TotalEq)]
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
#[deriving(Eq, Ord, TotalEq)]
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
#[deriving(Eq, Ord, TotalEq)]
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
#[deriving(Eq, Ord, TotalEq)]
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
#[feature(struct_variant)];
extern crate extra;
+extern crate rand;
struct Error;
// 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
// 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
#[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;
// 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)
// 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;
// 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 {
}
pub fn main() {
- use std::rand::Rng;
+ use rand::Rng;
let fns = ~[
calllink01,
calllink02,
// 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];