This code is not working(solved)


I am trying to test a system I made, and use a randomizing function to make sure it works, but it seems that the randomizer is not working.

///Randomize Traits
while randomize_traits {
    ///Set Random Traits
    var i = 0; //Set for loop variable
    for (i = 0; i < 200; i += 1) { //Begin for loop
        var i_randomizer = irandom_range(1,100); //Get randomizer scale, so that 0 is likelier than -1 or +1
        if i_randomizer <= 10 { //if on lower scale, make negative trait
            i_trait = -1; }
        else if i_randomizer > 10 && i_randomizer < 90 { //If on the middle, no trait
            i_trait = 0; }
        else if i_randomizer >= 90 { //If on the top, positive trait
            i_trait = 1; }
        array_traits[i] = i_trait; //Set trait
    randomize_traits = false;
This only randomizes the very first trait to either -1, 0, or 1, but the rest of the traits don't seem to be affected at all. I have initialized the whole array with 200 places by making them all 0.

Is there a problem with this code? If not, then I can post the code that reads the traits.


Why is it that when I post stuff it sometimes becomes apparent what the problem is lol. The array is 2D, but I didn't take that into consideration. Now it seems to be working
Last edited: