Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2a8e17f

Browse files
gfredericksdnolen
authored and
dnolen
committedNov 4, 2015
Generate larger range of random UUIDs
The random-uuid function was only generating hex characters from 0-e, but should be using 0-f. Adjusted the arg to the first rand-int call to make this work, and adjusted the second one as well, which should have no effect on the behavior but is less confusing to read.
1 parent 6dc027b commit 2a8e17f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/main/cljs/cljs/core.cljs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9861,8 +9861,8 @@ Maps become Objects. Arbitrary keys are encoded to by key->js."
98619861
(UUID. s nil))
98629862

98639863
(defn random-uuid []
9864-
(letfn [(hex [] (.toString (rand-int 15) 16))]
9865-
(let [rhex (.toString (bit-or 0x8 (bit-and 0x3 (rand-int 14))) 16)]
9864+
(letfn [(hex [] (.toString (rand-int 16) 16))]
9865+
(let [rhex (.toString (bit-or 0x8 (bit-and 0x3 (rand-int 16))) 16)]
98669866
(uuid
98679867
(str (hex) (hex) (hex) (hex)
98689868
(hex) (hex) (hex) (hex) "-"

0 commit comments

Comments
 (0)