about summary refs log tree commit diff
path: root/src/libcore/rand.rs
AgeCommit message (Collapse)AuthorLines
2013-05-22libstd: Rename libcore to libstd and libstd to libextra; update makefiles.Patrick Walton-1092/+0
This only changes the directory names; it does not change the "real" metadata names.
2013-05-19Use assert_eq! rather than assert! where possibleCorey Richardson-21/+21
2013-05-11clean up the last bit of warningsCorey Richardson-1/+0
2013-05-11auto merge of #6389 : sonwow/rust/issue-3356, r=bstriebors-1/+1
Fix for #3356
2013-05-10renamed vec::from_slice to vec::to_ownedYoungsoo Son-1/+1
2013-05-10Move core::task::local_data to core::local_dataYoungsoo Son-2/+2
2013-05-08libcore: Fix tests.Patrick Walton-21/+23
2013-05-08libcore: Remove mutable fields from rand.Patrick Walton-80/+96
2013-05-02Remove 'Local Variable' commentsBrendan Zabarauskas-9/+0
2013-05-01libcore: add N(0,1) and Exp(1) distributions to core::rand.Huon Wilson-0/+6
Sample from the normal and exponential distributions using the Ziggurat algorithm.
2013-04-29auto merge of #6073 : huonw/rust/core-rust-isaac, r=pcwaltonbors-47/+234
This replaces the wrapper around the runtime RNG with a pure Rust implementation of the same algorithm. This is much faster (up to 5x), and is hopefully safer. There is still (a little) room for optimisation: testing by summing 100,000,000 random `u32`s indicates this is about ~~40-50%~~ 10% slower than the pure C implementation (running as standalone executable, not in the runtime). (Only 6d50d55 is part of this PR, the first two are from #6058, but are required for the rt rng to be correct to compare against in the tests.)
2013-04-30core: add some inlining hints to methods/fns in rand.Huon Wilson-1/+32
2013-04-30core: a pure Rust implementation of the ISAAC RNG.Huon Wilson-46/+202
This replaces the wrapper around the runtime RNG with a pure Rust implementation of the same algorithm. This is faster (up to 5x), and is hopefully safer. There is still much room for optimisation: testing by summing 100,000,000 random `u32`s indicates this is about 40-50% slower than the pure C implementation (running as standalone executable, not in the runtime).
2013-04-29Revert "libcore: remove unnecessary deref"Tim Chevalier-1/+1
This reverts commit 9860fe10a19cc4997e58861df905f8dbe4de3c5b.
2013-04-28rand: Fix infinite recursionPhilipp Brüschweiler-1/+1
`self` has type `&@Rand`, so `*self` will be of type `@Rand` which causes this same impl to be called again.
2013-04-24libcore: remove unnecessary derefHuon Wilson-1/+1
2013-04-24libcore: unify `gen_<type>` methods on `rand::RngUtil` into the generic `gen`.Huon Wilson-178/+75
This moves all the basic random value generation into the Rand instances for each type and then removes the `gen_int`, `gen_char` (etc) methods on RngUtil, leaving only the generic `gen` and the more specialised methods. Also, removes some imports that are redundant due to a `use core::prelude::*` statement.
2013-04-24libcore: remove @Rng from rand, and use traits instead.Huon Wilson-158/+166
Also, rename RandRes -> IsaacRng, and make the constructors static methods.
2013-04-22auto merge of #5966 : alexcrichton/rust/issue-3083, r=graydonbors-1/+1
Closes #3083. This takes a similar approach to #5797 where a set is present on the `tcx` of used mutable definitions. Everything is by default warned about, and analyses must explicitly add mutable definitions to this set so they're not warned about. Most of this was pretty straightforward, although there was one caveat that I ran into when implementing it. Apparently when the old modes are used (or maybe `legacy_modes`, I'm not sure) some different code paths are taken to cause spurious warnings to be issued which shouldn't be issued. I'm not really sure how modes even worked, so I was having a lot of trouble tracking this down. I figured that because they're a legacy thing that I'd just de-mode the compiler so that the warnings wouldn't be a problem anymore (or at least for the compiler). Other than that, the entire compiler compiles without warnings of unused mutable variables. To prevent bad warnings, #5965 should be landed (which in turn is waiting on #5963) before landing this. I figured I'd stick it out for review anyway though.
2013-04-22libcore: Rand impls for tuples and ~/@ boxesHuon Wilson-0/+46
2013-04-21libcore: make rand::random return a generic value implementing `Rand`.Huon Wilson-4/+14
2013-04-20core: remove unused 'mut' variablesAlex Crichton-1/+1
2013-04-16libcore,std,syntax,rustc: move tests into `mod tests`, make them private (no ↵Huon Wilson-20/+20
pub mod or pub fn).
2013-04-11Fix formattingDan Luu-34/+40
2013-04-10Clarify commentDan Luu-1/+1
2013-04-10Add examples for Rng functions.Dan Luu-8/+176
2013-03-29librustc: Remove `fail_unless!`Patrick Walton-34/+34
2013-03-28Removing unused importsAlex Crichton-1/+1
2013-03-26Switched over a bunch of splitting funktions to non-allocating iteratorsMarvin Löbel-1/+3
2013-03-22librustc: Remove the `const` declaration form everywherePatrick Walton-1/+1
2013-03-22libcore: Remove `pure` from libcore. rs=depurePatrick Walton-2/+2
2013-03-22librustc: Remove all uses of `static` from functions. rs=destaticPatrick Walton-16/+16
2013-03-13librustc: Don't accept `as Trait` anymore; fix all occurrences of it.Patrick Walton-22/+100
2013-03-11Remove uses of logBrian Anderson-5/+4
2013-03-07librustc: Convert all uses of `assert` over to `fail_unless!`Patrick Walton-40/+40
2013-03-07libcore: Remove `extern mod { ... }` from libcore. rs=deexterningPatrick Walton-7/+12
2013-03-04De-implicit-self libcoreBen Striegel-33/+33
2013-02-28Remove legacy object creation mode, and convert remaining uses of itNiko Matsakis-6/+6
2013-02-28librustc: Mark all type implementations public. rs=impl-publicityPatrick Walton-1/+1
2013-02-27Turn old `drop` blocks into `Drop` traitsBen Striegel-1/+4
2013-02-20librustc: Separate most trait bounds with '+'. rs=plussingPatrick Walton-3/+3
2013-02-19rt: fix memory-unsafe random seed logic, r=valgrindcleanGraydon Hoare-17/+27
2013-02-15auto merge of #4964 : luqmana/rust/demove, r=graydonbors-3/+3
As per #4339/#3676 this pull removes all uses `move` and gets rid of parsing it in libsyntax. So that's one more thing to cross off #4707
2013-02-15libcore: Get rid of `move`.Luqman Aden-3/+3
2013-02-14encapsulate isaac RNG in rust_rng structChris Peterson-10/+10
2013-02-14librustc: Replace `impl Type : Trait` with `impl Trait for Type`. ↵Patrick Walton-17/+17
rs=implflipping
2013-02-13RIMOV core::randBen Striegel-1/+1
2013-02-07Make ~fn non-copyable, make &fn copyable, split barefn/closure types,Niko Matsakis-4/+0
correct handling of moves for struct-record update. Part of #3678. Fixes #2828, #3904, #4719.
2013-02-05core: Add a rand::Rand trait that is implemented by types that can beZack Corr-0/+100
randomly generated Also adds Rng::gen() for generating any type that implements the Rand trait
2013-01-24convert most of libcore records into structsErick Tryzelaar-15/+21