diff --git a/smnp.math.md b/smnp.math.md index f0c3b8e..28f172d 100644 --- a/smnp.math.md +++ b/smnp.math.md @@ -1,6 +1,6 @@ # Functions ## random -``` +```php random(min: int, max: int) #1 random(min: float, max: float) #2 random() #3 @@ -12,25 +12,25 @@ Returns a random number from a given range _exclusively_ (`#1`, `#2`). Returns t * `float` if passed arguments are of `float` type ## min -``` +```php min(numbers: list) ``` Returns the smallest number of given list. ## max -``` +```php max(numbers: list) ``` Returns the greatest number of given list. ## sample -``` +```php sample(list: list) ``` Returns a random item of given list. ## pick -``` +```php pick(items: list<>>) pick(...items: map<>) ``` @@ -47,7 +47,7 @@ Returns a random item of given list using a configuration maps. It is a more gen The sum of `chance` value of each item should be equal to 100. #### Example -``` +```php items = [ { chance -> 70, value -> "70%" }, { chance -> 25, value -> "25%" }, @@ -67,18 +67,18 @@ println("5% : ", collected.countBy("5%")); ``` ## mod -``` +```php mod(a: int, b: int) ``` Returns the remainder after division of `a` by `b`. ## range -``` +```php range(begin: int, end: int, step: int = 1) ``` Returns a list contained of integers from `begin` (inclusive) to `end` (exclusive) with given `step`. #### Example -``` +```php println(range(4, 20, 2)); # [4, 6, 8, 10, 12, 14, 16, 18] ``` \ No newline at end of file