Do you mean something like this:Betelgeuse wrote:... requesting Curves ...
Code: Select all
; THX OddBob.
; select a number between start or 0 and target,
; with a decreasing probability of selecting the
; target number. Curve determines the spread.
(setq probability (lambda (target curve start)
(block (run result)
(setq run True)
(if (not start) (setq start 0))
(setq result start)
(loop (and run (ls result target))
(if (leq (random 0 100) curve)
(setq result (add result 1))
(setq run Nil)
)
)
result
)
))
It works like this:
Code: Select all
;; return a number between 1 and 15, with a decreasing chance of returning higher numbers
(probability 15 75 1)
This means, that the higher the curve, the more likely we are of getting high numbers.
The function can potentially loop until it reaches target number iterations, so it is not really very efficient, and should only be used for relatively small target numbers (or relatively low curves).
If anybody can improve this, please let me know.
.]