Merge pull request #8 from guzba/master

Removable? https://nim-lang.org/docs/system.html#clamp%2CT%2CT%2CT
This commit is contained in:
treeform 2020-03-17 11:21:29 -07:00 committed by GitHub
commit b1f828ad55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,14 +2,6 @@ import math, random, strutils
export math
proc clamp*(n, min, max: float32): float32 =
## Clamps n to min, else returns max if n is higher.
if n < min:
return min
if n > max:
return max
return n
proc between*(value, min, max: float32): bool =
## Returns true if value is between min and max or equal to them.
(value >= min) and (value <= max)