File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 3d5fb470fb22dea6473fc1a4d265ce9494dd4120
2
+ refs/heads/master: d9776236c8991af312113741e74c20e2070f252f
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
5
5
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
Original file line number Diff line number Diff line change @@ -890,7 +890,7 @@ pub fn random<T: Rand>() -> T {
890
890
}
891
891
892
892
#[ cfg( test) ]
893
- mod tests {
893
+ mod test {
894
894
use option:: { Option , Some } ;
895
895
use super :: * ;
896
896
@@ -1109,3 +1109,37 @@ mod tests {
1109
1109
}
1110
1110
}
1111
1111
}
1112
+
1113
+ #[ cfg( test) ]
1114
+ mod bench {
1115
+ use extra:: test:: BenchHarness ;
1116
+ use rand:: * ;
1117
+ use sys:: size_of;
1118
+
1119
+ #[ bench]
1120
+ fn rand_xorshift( bh: & mut BenchHarness ) {
1121
+ let mut rng = XorShiftRng :: new ( ) ;
1122
+ do bh. iter {
1123
+ rng. gen :: <uint> ( ) ;
1124
+ }
1125
+ bh. bytes = size_of:: <uint >( ) as u64 ;
1126
+ }
1127
+
1128
+ #[ bench]
1129
+ fn rand_isaac( bh: & mut BenchHarness ) {
1130
+ let mut rng = IsaacRng : : new( ) ;
1131
+ do bh. iter {
1132
+ rng. gen :: <uint >( ) ;
1133
+ }
1134
+ bh. bytes = size_of:: <uint>( ) as u64 ;
1135
+ }
1136
+
1137
+ #[ bench]
1138
+ fn rand_shuffle_100( bh: & mut BenchHarness ) {
1139
+ let mut rng = XorShiftRng :: new( ) ;
1140
+ let x : & mut [ uint] = [ 1 , ..100 ] ;
1141
+ do bh. iter {
1142
+ rng. shuffle_mut( x) ;
1143
+ }
1144
+ }
1145
+ }
You can’t perform that action at this time.
0 commit comments