Created
May 25, 2026 03:33
-
-
Save moea/72ca3d0ae9c19a44b825dbb5e2634659 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| (declare RandState :: Type) | |
| #clj (defn make-rand-state-impl [seed] | |
| (clojure.core/atom (clojure.core/long seed))) | |
| #clj (defn next-rand-int-impl [state] | |
| (let [r (java.util.SplittableRandom. (clojure.core/long @state)) | |
| v (.nextInt r) | |
| next-seed (.nextLong r)] | |
| (clojure.core/reset! state next-seed) | |
| v)) | |
| (declare make-rand-state :: (-> Int RandState) | |
| :clj make-rand-state-impl) | |
| (declare next-rand-int :: (-> RandState Int) | |
| :clj next-rand-int-impl) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment