summaryrefslogtreecommitdiff
path: root/npc/functions/RNGesus.txt
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-05-24 13:47:28 -0300
committerJesusaves <cpntb1@ymail.com>2020-05-24 13:47:28 -0300
commit9c322449ade0d1952f6ca4dd73cc92413f61ca69 (patch)
tree1bff0731c4db0790ef57a2d524d739b1241ffa2c /npc/functions/RNGesus.txt
parent9c649056dc45d39e88036bdb2bb373c477f8571f (diff)
parent255cf7c47f76a6e2f12fc809473ce513c294dfa4 (diff)
downloadserverdata-jesusalva/inns.tar.gz
serverdata-jesusalva/inns.tar.bz2
serverdata-jesusalva/inns.tar.xz
serverdata-jesusalva/inns.zip
Merge branch 'master' into jesusalva/innsjesusalva/inns
Diffstat (limited to 'npc/functions/RNGesus.txt')
-rw-r--r--npc/functions/RNGesus.txt20
1 files changed, 17 insertions, 3 deletions
diff --git a/npc/functions/RNGesus.txt b/npc/functions/RNGesus.txt
index 6883f8f1..7224977c 100644
--- a/npc/functions/RNGesus.txt
+++ b/npc/functions/RNGesus.txt
@@ -1,16 +1,30 @@
// Evol functions.
// Authors:
// gumi
+// jesusalva
// Description:
// Randomization helper functions.
+// pseudo-fix randomness
+// rand2( min, max )
+function script rand2 {
+ if (getargcount() == 2) {
+ .@min=getarg(0)*100;
+ .@max=getarg(1)*100+99;
+ } else {
+ .@min=0;
+ .@max=getarg(0)*100-1;
+ }
+ return rand(.@min, .@max)/100;
+}
+
// any(<arg>{, ...<arg>})
// returns one argument randomly
function script any {
- return getarg(rand(getargcount()));
+ return getarg(rand2(getargcount()));
}
@@ -19,7 +33,7 @@ function script any {
// returns any member of the array
function script any_of {
- return getelementofarray(getarg(0), getarrayindex(getarg(0)) + rand(getarraysize(getarg(0)) - getarrayindex(getarg(0))));
+ return getelementofarray(getarg(0), getarrayindex(getarg(0)) + rand2(getarraysize(getarg(0)) - getarrayindex(getarg(0))));
}
@@ -54,7 +68,7 @@ function script relative_array_random {
set(getelementofarray(getarg(0), 0), .@total_prob);
}
- .@target_sum = rand(0, .@total_prob);
+ .@target_sum = rand2(0, .@total_prob);
for (.@i = .@initial_index; .@sum < .@target_sum; .@i += 2) {
if (.@is_str) {