-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_math_rand.ini
41 lines (38 loc) · 853 Bytes
/
_math_rand.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
namespace = math\rand
; ---------------------------DESCRIPTION---
; Returns an random Float value or NaN
; Randon number (inclusive) from Min to Max
;
; -------------------------------EXAMPLE---
; $\math\rand\min = 3
; $\math\rand\max = 50
; run = commandlist\math\rand\run
; x = $\math\rand\out
; ; x is [3,50]
[Constants]
global $min
global $max
global $out
[CommandListRun]
local $pi = 3.14159265
local $e = 2.71828182846
local $first_call
local $seed
if !$first_call
$first_call = 1
$seed = time - time // 1
endif
local $temp = (256 * $seed * ($e**$pi))+0.0000001
$\math\cos\in = 123456789 % $temp
run = CommandList\math\cos\run
$temp = $\math\cos\out
if $temp == NaN
$seed = time - time // 1
$out = NaN
else
$seed = $temp + 1
$temp = $temp - $temp // 1
$out = $temp * ($max - $min + 1) + $min
endif
$min = 0
$max = 0