random-weighted: Use fry instead of bake
parent
3c9d01deb9
commit
55ee2258a7
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
USING: kernel namespaces arrays quotations sequences assocs combinators
|
USING: kernel namespaces arrays quotations sequences assocs combinators
|
||||||
mirrors math math.vectors random macros bake ;
|
mirrors math math.vectors random macros fry ;
|
||||||
|
|
||||||
IN: random-weighted
|
IN: random-weighted
|
||||||
|
|
||||||
|
@ -16,5 +16,5 @@ probabilities layers [ 1000 * ] map 1000 random [ > ] curry find drop ;
|
||||||
dup [ second ] map swap [ first ] map random-weighted swap nth ;
|
dup [ second ] map swap [ first ] map random-weighted swap nth ;
|
||||||
|
|
||||||
MACRO: call-random-weighted ( exp -- )
|
MACRO: call-random-weighted ( exp -- )
|
||||||
[ keys ] [ values <enum> >alist ] bi swap
|
[ keys ] [ values <enum> >alist ] bi
|
||||||
[ , random-weighted , case ] bake ;
|
'[ , random-weighted , case ] ;
|
||||||
|
|
Loading…
Reference in New Issue