@@ -16,15 +16,13 @@ use collections::{Collection, Mutable, Set, MutableSet, Map, MutableMap};
1616use default:: Default ;
1717use fmt:: Show ;
1818use fmt;
19- use hash:: { Hash , Hasher , sip } ;
19+ use hash:: { Hash , Hasher , RandomSipHasher } ;
2020use iter:: { Iterator , FilterMap , Chain , Repeat , Zip , Extendable } ;
2121use iter:: { range, range_inclusive, FromIterator } ;
2222use iter;
2323use mem:: replace;
2424use num;
2525use option:: { Some , None , Option } ;
26- use rand:: Rng ;
27- use rand;
2826use result:: { Ok , Err } ;
2927
3028mod table {
@@ -733,7 +731,7 @@ impl DefaultResizePolicy {
733731/// }
734732/// ```
735733#[ deriving( Clone ) ]
736- pub struct HashMap < K , V , H = sip :: SipHasher > {
734+ pub struct HashMap < K , V , H = RandomSipHasher > {
737735 // All hashes are keyed on these values, to prevent hash collision attacks.
738736 hasher : H ,
739737
@@ -1033,18 +1031,15 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> MutableMap<K, V> for HashMap<K, V, H>
10331031
10341032}
10351033
1036- impl < K : Hash + Eq , V > HashMap < K , V , sip :: SipHasher > {
1034+ impl < K : Hash + Eq , V > HashMap < K , V , RandomSipHasher > {
10371035 /// Create an empty HashMap.
1038- pub fn new ( ) -> HashMap < K , V , sip :: SipHasher > {
1036+ pub fn new ( ) -> HashMap < K , V , RandomSipHasher > {
10391037 HashMap :: with_capacity ( INITIAL_CAPACITY )
10401038 }
10411039
10421040 /// Creates an empty hash map with the given initial capacity.
1043- pub fn with_capacity ( capacity : uint ) -> HashMap < K , V , sip:: SipHasher > {
1044- let mut r = rand:: task_rng ( ) ;
1045- let r0 = r. gen ( ) ;
1046- let r1 = r. gen ( ) ;
1047- let hasher = sip:: SipHasher :: new_with_keys ( r0, r1) ;
1041+ pub fn with_capacity ( capacity : uint ) -> HashMap < K , V , RandomSipHasher > {
1042+ let hasher = RandomSipHasher :: new ( ) ;
10481043 HashMap :: with_capacity_and_hasher ( capacity, hasher)
10491044 }
10501045}
@@ -1489,7 +1484,7 @@ pub type SetMoveItems<K> =
14891484/// HashMap where the value is (). As with the `HashMap` type, a `HashSet`
14901485/// requires that the elements implement the `Eq` and `Hash` traits.
14911486#[ deriving( Clone ) ]
1492- pub struct HashSet < T , H = sip :: SipHasher > {
1487+ pub struct HashSet < T , H = RandomSipHasher > {
14931488 map : HashMap < T , ( ) , H >
14941489}
14951490
@@ -1529,15 +1524,15 @@ impl<T: Eq + Hash<S>, S, H: Hasher<S>> MutableSet<T> for HashSet<T, H> {
15291524 fn remove ( & mut self , value : & T ) -> bool { self . map . remove ( value) }
15301525}
15311526
1532- impl < T : Hash + Eq > HashSet < T , sip :: SipHasher > {
1527+ impl < T : Hash + Eq > HashSet < T , RandomSipHasher > {
15331528 /// Create an empty HashSet
1534- pub fn new ( ) -> HashSet < T , sip :: SipHasher > {
1529+ pub fn new ( ) -> HashSet < T , RandomSipHasher > {
15351530 HashSet :: with_capacity ( INITIAL_CAPACITY )
15361531 }
15371532
15381533 /// Create an empty HashSet with space for at least `n` elements in
15391534 /// the hash table.
1540- pub fn with_capacity ( capacity : uint ) -> HashSet < T , sip :: SipHasher > {
1535+ pub fn with_capacity ( capacity : uint ) -> HashSet < T , RandomSipHasher > {
15411536 HashSet { map : HashMap :: with_capacity ( capacity) }
15421537 }
15431538}
0 commit comments