Fix Hashtbl.Make.of_seq creating randomized tables
Book-keeping error only - although it does potentially initialise the PRNG unnecessarily.master
parent
fc8be501aa
commit
947486007e
3
Changes
3
Changes
|
@ -356,7 +356,8 @@ OCaml 4.08.0
|
||||||
(Pierre Weis, Richard Bonichon, review by Florian Angeletti)
|
(Pierre Weis, Richard Bonichon, review by Florian Angeletti)
|
||||||
|
|
||||||
- GPR#2202: Correct Hashtbl.MakeSeeded.{add_seq,replace_seq,of_seq} to use
|
- GPR#2202: Correct Hashtbl.MakeSeeded.{add_seq,replace_seq,of_seq} to use
|
||||||
functor hash function instead of default hash function.
|
functor hash function instead of default hash function. Hashtbl.Make.of_seq
|
||||||
|
shouldn't create randomized hash tables.
|
||||||
(David Allsopp, review by Alain Frisch)
|
(David Allsopp, review by Alain Frisch)
|
||||||
|
|
||||||
### Other libraries:
|
### Other libraries:
|
||||||
|
|
|
@ -482,6 +482,10 @@ module K1 = struct
|
||||||
let hash (_seed: int) x = H.hash x
|
let hash (_seed: int) x = H.hash x
|
||||||
end)
|
end)
|
||||||
let create sz = create ~random:false sz
|
let create sz = create ~random:false sz
|
||||||
|
let of_seq i =
|
||||||
|
let tbl = create 16 in
|
||||||
|
replace_seq tbl i;
|
||||||
|
tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -570,6 +574,10 @@ module K2 = struct
|
||||||
let hash (_seed: int) x = H2.hash x
|
let hash (_seed: int) x = H2.hash x
|
||||||
end)
|
end)
|
||||||
let create sz = create ~random:false sz
|
let create sz = create ~random:false sz
|
||||||
|
let of_seq i =
|
||||||
|
let tbl = create 16 in
|
||||||
|
replace_seq tbl i;
|
||||||
|
tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -670,5 +678,9 @@ module Kn = struct
|
||||||
let hash (_seed: int) x = H.hash x
|
let hash (_seed: int) x = H.hash x
|
||||||
end)
|
end)
|
||||||
let create sz = create ~random:false sz
|
let create sz = create ~random:false sz
|
||||||
|
let of_seq i =
|
||||||
|
let tbl = create 16 in
|
||||||
|
replace_seq tbl i;
|
||||||
|
tbl
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -599,4 +599,8 @@ module Make(H: HashedType): (S with type key = H.t) =
|
||||||
let hash (_seed: int) x = H.hash x
|
let hash (_seed: int) x = H.hash x
|
||||||
end)
|
end)
|
||||||
let create sz = create ~random:false sz
|
let create sz = create ~random:false sz
|
||||||
|
let of_seq i =
|
||||||
|
let tbl = create 16 in
|
||||||
|
replace_seq tbl i;
|
||||||
|
tbl
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue