Skip to content

Commit 9c9e964

Browse files
committed
---
yaml --- r: 71930 b: refs/heads/dist-snap c: 62c94d3 h: refs/heads/master v: v3
1 parent 6aca115 commit 9c9e964

File tree

3 files changed

+11
-185
lines changed

3 files changed

+11
-185
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: b50030718cf28f2a5a81857a26b57442734fe854
10-
refs/heads/dist-snap: cf34b31704257ef79cd0f9286314c10fa15b7bf9
10+
refs/heads/dist-snap: 62c94d3a38985f5f6f12920d14867e73a19fefe2
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ do
859859
LDFLAGS=$LLVM_LDFLAGS
860860

861861
LLVM_FLAGS="$LLVM_TARGETS $LLVM_OPTS $LLVM_BUILD \
862-
$LLVM_HOST $LLVM_TARGET"
862+
$LLVM_HOST $LLVM_TARGET --with-python=$CFG_PYTHON"
863863

864864
msg "configuring LLVM with:"
865865
msg "$LLVM_FLAGS"

branches/dist-snap/src/libcore/rand.rs

Lines changed: 9 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -150,21 +150,7 @@ pub struct Weighted<T> {
150150

151151
pub trait RngUtil {
152152
fn gen<T:Rand>(&self) -> T;
153-
/**
154-
* Return a random int
155-
*
156-
* *Example*
157-
*
158-
* ~~~
159-
*
160-
* use core::rand::RngUtil;
161-
*
162-
* fn main() {
163-
* rng = rand::Rng();
164-
* println(fmt!("%d",rng.gen_int()));
165-
* }
166-
* ~~~
167-
*/
153+
/// Return a random int
168154
fn gen_int(&self) -> int;
169155
fn gen_int_range(&self, start: int, end: int) -> int;
170156
/// Return a random i8
@@ -190,21 +176,7 @@ pub trait RngUtil {
190176
fn gen_u32(&self) -> u32;
191177
/// Return a random u64
192178
fn gen_u64(&self) -> u64;
193-
/**
194-
* Return random float in the interval [0,1]
195-
*
196-
* *Example*
197-
*
198-
* ~~~
199-
*
200-
* use core::rand::RngUtil;
201-
*
202-
* fn main() {
203-
* rng = rand::Rng();
204-
* println(fmt!("%f",rng.gen_float()));
205-
* }
206-
* ~~~
207-
*/
179+
/// Return a random float in the interval [0,1]
208180
fn gen_float(&self) -> float;
209181
/// Return a random f32 in the interval [0,1]
210182
fn gen_f32(&self) -> f32;
@@ -216,184 +188,38 @@ pub trait RngUtil {
216188
* Return a char randomly chosen from chars, failing if chars is empty
217189
*/
218190
fn gen_char_from(&self, chars: &str) -> char;
219-
/**
220-
* Return a random bool
221-
*
222-
* *Example*
223-
*
224-
* ~~~
225-
*
226-
* use core::rand::RngUtil;
227-
*
228-
* fn main() {
229-
* rng = rand::Rng();
230-
* println(fmt!("%b",rng.gen_bool()));
231-
* }
232-
* ~~~
233-
*/
191+
/// Return a random bool
234192
fn gen_bool(&self) -> bool;
235-
/**
236-
* Return a bool with a 1 in n chance of true
237-
*
238-
* *Example*
239-
*
240-
* ~~~
241-
*
242-
* use core::rand::RngUtil;
243-
*
244-
* fn main() {
245-
* rng = rand::Rng();
246-
* println(fmt!("%b",rng.gen_weighted_bool(3)));
247-
* }
248-
* ~~~
249-
*/
193+
/// Return a bool with a 1 in n chance of true
250194
fn gen_weighted_bool(&self, n: uint) -> bool;
251195
/**
252196
* Return a random string of the specified length composed of A-Z,a-z,0-9
253-
*
254-
* *Example*
255-
*
256-
* ~~~
257-
*
258-
* use core::rand::RngUtil;
259-
*
260-
* fn main() {
261-
* rng = rand::Rng();
262-
* println(rng.gen_str(8));
263-
* }
264-
* ~~~
265197
*/
266198
fn gen_str(&self, len: uint) -> ~str;
267-
/**
268-
* Return a random byte string of the specified length
269-
*
270-
* *Example*
271-
*
272-
* ~~~
273-
*
274-
* use core::rand::RngUtil;
275-
*
276-
* fn main() {
277-
* rng = rand::Rng();
278-
* println(fmt!("%?",rng.gen_bytes(8)));
279-
* }
280-
* ~~~
281-
*/
199+
/// Return a random byte string of the specified length
282200
fn gen_bytes(&self, len: uint) -> ~[u8];
283-
///
284-
/**
285-
* Choose an item randomly, failing if values is empty
286-
*
287-
* *Example*
288-
*
289-
* ~~~
290-
*
291-
* use core::rand::RngUtil;
292-
*
293-
* fn main() {
294-
* rng = rand::Rng();
295-
* println(fmt!("%d",rng.choose([1,2,4,8,16,32])));
296-
* }
297-
* ~~~
298-
*/
201+
/// Choose an item randomly, failing if values is empty
299202
fn choose<T:Copy>(&self, values: &[T]) -> T;
300203
/// Choose Some(item) randomly, returning None if values is empty
301204
fn choose_option<T:Copy>(&self, values: &[T]) -> Option<T>;
302205
/**
303206
* Choose an item respecting the relative weights, failing if the sum of
304207
* the weights is 0
305-
*
306-
* *Example*
307-
*
308-
* ~~~
309-
*
310-
* use core::rand::RngUtil;
311-
*
312-
* fn main() {
313-
* rng = rand::Rng();
314-
* let x = [rand::Weighted {weight: 4, item: 'a'},
315-
* rand::Weighted {weight: 2, item: 'b'},
316-
* rand::Weighted {weight: 2, item: 'c'}];
317-
* println(fmt!("%c",rng.choose_weighted(x)));
318-
* }
319-
* ~~~
320208
*/
321209
fn choose_weighted<T:Copy>(&self, v : &[Weighted<T>]) -> T;
322210
/**
323211
* Choose Some(item) respecting the relative weights, returning none if
324212
* the sum of the weights is 0
325-
*
326-
* *Example*
327-
*
328-
* ~~~
329-
*
330-
* use core::rand::RngUtil;
331-
*
332-
* fn main() {
333-
* rng = rand::Rng();
334-
* let x = [rand::Weighted {weight: 4, item: 'a'},
335-
* rand::Weighted {weight: 2, item: 'b'},
336-
* rand::Weighted {weight: 2, item: 'c'}];
337-
* println(fmt!("%?",rng.choose_weighted_option(x)));
338-
* }
339-
* ~~~
340213
*/
341214
fn choose_weighted_option<T:Copy>(&self, v: &[Weighted<T>]) -> Option<T>;
342215
/**
343216
* Return a vec containing copies of the items, in order, where
344217
* the weight of the item determines how many copies there are
345-
*
346-
* *Example*
347-
*
348-
* ~~~
349-
*
350-
* use core::rand::RngUtil;
351-
*
352-
* fn main() {
353-
* rng = rand::Rng();
354-
* let x = [rand::Weighted {weight: 4, item: 'a'},
355-
* rand::Weighted {weight: 2, item: 'b'},
356-
* rand::Weighted {weight: 2, item: 'c'}];
357-
* println(fmt!("%?",rng.weighted_vec(x)));
358-
* }
359-
* ~~~
360218
*/
361219
fn weighted_vec<T:Copy>(&self, v: &[Weighted<T>]) -> ~[T];
362-
/**
363-
* Shuffle a vec
364-
*
365-
* *Example*
366-
*
367-
* ~~~
368-
*
369-
* use core::rand::RngUtil;
370-
*
371-
* fn main() {
372-
* rng = rand::Rng();
373-
* println(fmt!("%?",rng.shuffle([1,2,3])));
374-
* }
375-
* ~~~
376-
*/
220+
/// Shuffle a vec
377221
fn shuffle<T:Copy>(&self, values: &[T]) -> ~[T];
378-
/**
379-
* Shuffle a mutable vec in place
380-
*
381-
* *Example*
382-
*
383-
* ~~~
384-
*
385-
* use core::rand::RngUtil;
386-
*
387-
* fn main() {
388-
* rng = rand::Rng();
389-
* let mut y = [1,2,3];
390-
* rng.shuffle_mut(y);
391-
* println(fmt!("%?",y));
392-
* rng.shuffle_mut(y);
393-
* println(fmt!("%?",y));
394-
* }
395-
* ~~~
396-
*/
222+
/// Shuffle a mutable vec in place
397223
fn shuffle_mut<T>(&self, values: &mut [T]);
398224
}
399225

@@ -511,7 +337,7 @@ impl RngUtil for @Rng {
511337
self.next() & 1u32 == 1u32
512338
}
513339

514-
/// Return a bool with a 1-in-n chance of true
340+
/// Return a bool with a 1 in n chance of true
515341
fn gen_weighted_bool(&self, n: uint) -> bool {
516342
if n == 0u {
517343
true

0 commit comments

Comments
 (0)