Integer Methods - Gnorion/BizVR GitHub Wiki

Integer Methods

Method Example
+ - * / ** = += -= *= < <= > >= <>
.absVal -42.absVal returns 42
.div(divisor) 42.div(5) returns 8
.gcd(integer) 42.gcd(18) returns 6
in int1...int2 42 in 36...73 returns true. example usage: person.age in [limit.lower ... limit.upper]
.ln
.isPrime 37.isPrime returns true
.isProbablyPrime
.factorial 6.factorial returns 720
.factors 15.factors returns {1,3,5}
.log
.log(base)
.max(integer) 100.max(50) returns 100
.min(integer) 100.min(50) returns 50
.mod(integer) 15.mod 4 returns 3
.permutationsOf(r) 5.permutationsOf(3) returns 60 The number of ways to choose a sample of r elements from a set of n distinct objects where order does matter and replacements are not allowed. When n = r this reduces to n!, a simple factorial of n.
.circularPermutations 5.circularPermutations returns 24 The number of ways to arrange n distinct objects along a fixed circle
.combinationsOf(r) 5.combinationsOf(3) returns 10 The number of ways to choose a sample of r elements from a set of n distinct objects where order does not matter and replacements are not allowed
.random(min,max) returns a random number in the range
.toDecimal 27.toDecimal return 27.0
.toString 27.toString returns '27'
⚠️ **GitHub.com Fallback** ⚠️