diff options
Diffstat (limited to 'stdlib/source/lux/math/random.lux')
-rw-r--r-- | stdlib/source/lux/math/random.lux | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux index 24fa17dbe..d998168d4 100644 --- a/stdlib/source/lux/math/random.lux +++ b/stdlib/source/lux/math/random.lux @@ -113,6 +113,14 @@ (Random Frac) (:: ..monad map frac.bits-to-frac ..nat)) +(def: #export safe-frac + (Random Frac) + (:: ..monad map + (|>> (i/% +1,000,000) + .int-to-frac + (f// +1,000,000.0)) + ..int)) + (def: #export (char set) (-> unicode.Set (Random Char)) (let [summary (finger.tag set) @@ -156,8 +164,8 @@ right <gen>] (wrap (<ctor> left right))))] - [ratio r.Ratio r.ratio nat] - [complex c.Complex c.complex frac] + [ratio r.Ratio r.ratio ..nat] + [complex c.Complex c.complex ..safe-frac] ) (def: #export (and left right) |