Open umajho opened 1 year ago
类似 m..n、m..、..n、m..=n、..=n 这样。
m..n
m..
..n
m..=n
..=n
在用于像是 reroll(exp, m..n) 的场景时:
reroll(exp, m..n)
exp
以后有空了再看看吧。
在想,像 \(x -> x <= 5) 这样写的闭包应该可以直接视为范围。 甚至像是 \(x -> x) 或 \(x -> not x) 这样,在当 x 是布尔值时也可以特殊对待? 总之目前是不打算考虑这些事情的。
\(x -> x <= 5)
\(x -> x)
\(x -> not x)
类似
m..n
、m..
、..n
、m..=n
、..=n
这样。在用于像是
reroll(exp, m..n)
的场景时:exp
的范围,在m..n
不在范围内时就能直接返回错误。exp
产出值的概率可以直接算出来,那就可以无需重试一次产出m..n
范围内的值。(或者返回不在范围内的错误。)以后有空了再看看吧。