Created
November 8, 2019 12:24
-
-
Save mpenet/4c2e5ecd95b90aaf426e9113e810d9fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn deterministic-sampler | |
[rate] | |
(let [bound (Integer/divideUnsigned -1 rate)] ;; -1 as int is 0xffffffff | |
(fn [s] | |
(pos? (Integer/compareUnsigned bound (hash s)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment