about summary refs log tree commit diff
path: root/src/libextra
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2014-03-02 12:59:35 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2014-03-12 11:31:43 +1100
commit689f19722fabd9aab61e826e00140a7fe7084afa (patch)
treef1b124415b95601fb001fe922b4e98b62f893c78 /src/libextra
parent198caa87cd870f8fd52bf0bd5fe471cf439c12f0 (diff)
downloadrust-689f19722fabd9aab61e826e00140a7fe7084afa.tar.gz
rust-689f19722fabd9aab61e826e00140a7fe7084afa.zip
rand: deprecate `rng`.
This should be called far less than it is because it does expensive OS
interactions and seeding of the internal RNG, `task_rng` amortises this
cost. The main problem is the name is so short and suggestive.

The direct equivalent is `StdRng::new`, which does precisely the same
thing.

The deprecation will make migrating away from the function easier.
Diffstat (limited to 'src/libextra')
-rw-r--r--src/libextra/tempfile.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libextra/tempfile.rs b/src/libextra/tempfile.rs
index 4e4d80ae292..905541604e0 100644
--- a/src/libextra/tempfile.rs
+++ b/src/libextra/tempfile.rs
@@ -12,8 +12,7 @@
 
 
 use std::os;
-use rand::Rng;
-use rand;
+use rand::{task_rng, Rng};
 use std::io;
 use std::io::fs;
 
@@ -35,7 +34,7 @@ impl TempDir {
             return TempDir::new_in(&abs_tmpdir, suffix);
         }
 
-        let mut r = rand::rng();
+        let mut r = task_rng();
         for _ in range(0u, 1000) {
             let p = tmpdir.join(r.gen_ascii_str(16) + suffix);
             match fs::mkdir(&p, io::UserRWX) {