Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_scr_get_random_number_order

(view raw script w/o annotations or w/e)
1
function scr_get_random_number_order
scr_get_random_number_order

function scr_get_random_number_order(argument0, argument1) //gml_Script_scr_get_random_number_order { var rnumber_for_max = argument1 - argument0 for (i = 0; i <= rnumber_for_max; i++) rnumber_order[i] = argument0 + i for (i = 0; i <= (rnumber_for_max - 1); i++) { var rnumber_switch = irandom_range(i, rnumber_for_max) if (rnumber_switch != i) { var rnumber_temp = rnumber_order[i] rnumber_order[i] = rnumber_order[rnumber_switch] rnumber_order[rnumber_switch] = rnumber_temp } } }
(argument0, argument1) //gml_Script_scr_get_random_number_order
2
{
3
    var rnumber_for_max = argument1 - argument0
4
    for (i = 0; i <= rnumber_for_max; i++)
5
        rnumber_order[i] = argument0 + i
6
    for (i = 0; i <= (rnumber_for_max - 1); i++)
7
    {
8
        var rnumber_switch = irandom_range(i, rnumber_for_max)
9
        if (rnumber_switch != i)
10
        {
11
            var rnumber_temp = rnumber_order[i]
12
            rnumber_order[i] = rnumber_order[rnumber_switch]
13
            rnumber_order[rnumber_switch] = rnumber_temp
14
        }
15
    }
16
}