Members
(constant) TWOPI :Number
- Source:
- Default Value:
- 2*pi
Also known as global.tau
Type:
- Number
(constant) NV_MAGICCONST :Number
- Source:
- Default Value:
- 4 * exp( -0.5 ) / sqrt( 2.0 )
Also known as global.nv_magicconst. Used in normal variate random distribution.
Type:
- Number
(constant) SMALL_FACTORIALS :Number
- Source:
- Default Value:
- [0!..20!]
Also known as global.small_factorials. Lookup table for int64 factorial values.
Type:
- Number
Methods
range(startopt, stop, stepopt) → {Range}
- Source:
helper function for calling Range constructor
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
start |
Number |
<optional> |
0
|
|
stop |
Number | |||
step |
Number |
<optional> |
1
|
Returns:
iterable Range struct
- Type
- Range
arange(startopt, stop, stepopt) → {Array}
- Source:
returns range array
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
start |
Number |
<optional> |
0
|
|
stop |
Number | |||
step |
Number |
<optional> |
1
|
Returns:
- Type
- Array
irange(startopt, stop, stepopt) → {Iterator}
- Source:
returns range iterator
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
start |
Number |
<optional> |
0
|
|
stop |
Number | |||
step |
Number |
<optional> |
1
|
Returns:
- Type
- Iterator
range_prod(startopt, stop, stepopt) → {Number}
- Source:
Returns product of all numbers in range
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
start |
Number |
<optional> |
1
|
|
stop |
Number | |||
step |
Number |
<optional> |
1
|
Returns:
- Type
- Number
new_random(seedopt) → {Random}
- Source:
creates Random object that uses Park–Miller random number generator
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
seed |
Number |
<optional> |
Returns:
- Type
- Random
assert(condidion, message)
- Source:
Asserts that a condition is true. If it isn't it throws an error with the given message.
Parameters:
Name | Type | Description |
---|---|---|
condidion |
Bool | |
message |
String |
assert_equals(expected, actuals, messageopt)
- Source:
Asserts that two arguments are equal. If they are not, an error is thrown with the given message.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
expected |
Any | ||
actuals |
Any | ||
message |
String |
<optional> |
assert_array_equals(expected, actuals, messageopt)
- Source:
Asserts that two arguments are equal. If they are not, an error is thrown with the given message.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
expected |
Array | ||
actuals |
Array | ||
message |
String |
<optional> |
new_list()
- Source:
returns ds_list
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
... |
<optional> |
new_stack()
- Source:
returns ds_stack
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
... |
<optional> |
new_queue()
- Source:
returns ds_queue
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
... |
<optional> |
new_map()
- Source:
returns ds_map
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
... |
array |
<optional> |
key, value pairs |
new_priority()
- Source:
returns ds_priority
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
... |
array |
<optional> |
value, priority pairs |
apply(function, arguments) → {Any}
- Source:
Executes function with arguments passed as array. Up to 16 arguments supported.
Example
apply( min, [ 1, 2, 3 ] ) --> 1
Parameters:
Name | Type | Description |
---|---|---|
function |
Method | |
arguments |
Array |
Returns:
Result returned by function
- Type
- Any
to_string(object, separatoropt) → {String}
- Source:
Returs string representation of object
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
object |
Any | ||
separator |
<optional> |
Returns:
- Type
- String
log()
- Source:
Concatenates all arguments and outputs to console using show_debug_message
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
... |
Any |
<optional> |
_add(a, b) → {Number}
- Source:
Add values of two arguments
Example
_add( 2, 2 ) --> 4
_add( "foo", "bar" ) --> "foobar:
Parameters:
Name | Type | Description |
---|---|---|
a |
Number | |
b |
Number |
Returns:
a + b
- Type
- Number
bit_length(a) → {Number}
- Source:
Returns number of bits that are needed to represent a.
Example
bit_length( -37 ) --> 6 // -37 = -0b100101
Parameters:
Name | Type | Description |
---|---|---|
a |
Number |
Returns:
- Type
- Number
_eq(a, b) → {Bool}
- Source:
Returns true if two arguments are equal
Parameters:
Name | Type | Description |
---|---|---|
a |
Any | |
b |
Any |
Returns:
- Type
- Bool
factorial(x) → {Number}
- Source:
Return x factorial as an integer.
Parameters:
Name | Type | Description |
---|---|---|
x |
Number |
Returns:
- Type
- Number
_div(a, b) → {Number}
- Source:
- See:
Divides first argment by the secone one
Example
_div( 4, 2 ) --> 2
Parameters:
Name | Type | Description |
---|---|---|
a |
Number | |
b |
Number |
Returns:
a / b
- Type
- Number
_floordiv(a, b) → {Number}
- Source:
- See:
Divides first argment by the secone one and returns integer part.
Example
_div( 5, 2 ) --> 2.50
_floordiv( 5, 2 ) --> 2
Parameters:
Name | Type | Description |
---|---|---|
a |
Number | |
b |
Number |
Returns:
a div b
- Type
- Number
_identity(a) → {Any}
- Source:
Function that returns it's argument
Example
_identity( 10 ) --> 10
Parameters:
Name | Type | Description |
---|---|---|
a |
Any |
Returns:
a
- Type
- Any
is_between(value, a, b) → {Bool}
- Source:
Check if value is in range [ a, b ]
Parameters:
Name | Type | Description |
---|---|---|
value |
Number | |
a |
Number | |
b |
Number |
Returns:
- Type
- Bool
isqrt(n) → {Number}
- Source:
Return the integer part of the square root of n.
Example
isqrt( 6 ) --> 2
Parameters:
Name | Type | Description |
---|---|---|
n |
Number |
Returns:
- Type
- Number
_max(_a, _b) → {Number}
- Source:
Returns largest of the input values
Example
_max( 1, 2, 3 ) --> 3
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
_a |
Number | ||
_b |
Number | ||
... |
Number |
<optional> |
Returns:
Largest of the input values
- Type
- Number
_min(_a, _b) → {Number}
- Source:
Returns smallest of the input values
Example
_min( 1, 2, 3 ) --> 1
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
_a |
Number | ||
_b |
Number | ||
... |
Number |
<optional> |
Returns:
Smallest of the input values
- Type
- Number
_mod(a, b) → {Number}
- Source:
- See:
Divides first argment by the secone one and returns modulus.
Example
_mod( 4, 2 ) --> 0
Parameters:
Name | Type | Description |
---|---|---|
a |
Number | |
b |
Number |
Returns:
modulus of a divided by b
- Type
- Number
_mul(a, b) → {Number}
- Source:
Multiplies argument values
Example
_mul( 2, 2 ) --> 4
Parameters:
Name | Type | Description |
---|---|---|
a |
Number | |
b |
Number |
Returns:
a * b
- Type
- Number
_rem(a, b) → {Number}
- Source:
- See:
Divides first argment by the secone one and returns remainder.
Example
_rem( 4, 2 ) --> 0
Parameters:
Name | Type | Description |
---|---|---|
a |
Number | |
b |
Number |
Returns:
a % b
- Type
- Number
_pow(a, b) → {Number}
- Source:
Substract second argument from the first one
Example
_pow( 2, 2 ) --> 4
Parameters:
Name | Type | Description |
---|---|---|
a |
Number | |
b |
Number |
Returns:
power( a, b )
- Type
- Number
_sub(a, b) → {Number}
- Source:
Substract second argument from the first one
Example
_sub( 4, 2 ) --> 2
Parameters:
Name | Type | Description |
---|---|---|
a |
Number | |
b |
Number |
Returns:
a - b
- Type
- Number
_truth(a) → {Bool}
- Source:
Returns if argument is true
Example
_truth( 1 ) --> true
_truth( 0.2 ) --> false
Parameters:
Name | Type | Description |
---|---|---|
a |
Any |
Returns:
Boolean representation of object
- Type
- Bool