ExamplesDraw

Examples: Draw

Woven from its 190 bytes

Draw

Pick one name from a list with the hash of the slot.

Language
Lisp
Bytecode
190bytes
Cards
22
Units on the Weft VM
38 834CU
Runs
Inline, in one transaction
; Hash the current slot and take it modulo the list.
(define names (list "ada" "grace" "alan" "edsger"))
(define h (sha256 (str (slot))))
(define pick (mod (num (string-append "0x" (get (split h "") 0) (get (split h "") 1))) (len names)))
(log "slot" (slot) "hash" h)
(get names pick)