[SOLVED]Does randomize have a specific place it needs called?

S

spoonsinbunnies

Guest
Hey all, been spending 3 days developing a neat algorithm for the lols to play a top down shooter, the problem Ive found though is unless I just add a bunch of garbled new code, even after throwing in randomize in create, game start, and even in desperation right before the array of random weights is made it doesn't seem to change the weights of my generated lists. At first I was just thinking it was the editor but making it as a executeable has yielded the same results. Is this something to do with me using Irandom_range? Did they mess it up in game maker studios one and im missing it now because im so far behind? since I don't want people grasping at straws on what I mean code incoming. Ive been using gamemaker for coding random gibberish for close to ten years, and maybe I just fried my brain from overcoding but seriously, I don't get it. ive

create:
Code:
randomize();
image_speed=0;
for (var a=0; a<31 a++;)//connection strengths for nureal network
{
b=irandom_range(-100,100)/100
i[a]=b
}
game start
Code:
randomize();
EDIT: Whelp apparently whatever old version of game maker I have is glitched, putting randomize in level start works although game start does not? At any rate leaving this for any other poor soul like 15 updates behind as well...
 
Last edited by a moderator:

Kyon

Member
so var b should be a random between -1 and 1 right? Because that's what it's doing.
anyway, you only have to use randomize once somewhere,I have it at the create event of my controller object.

The only thing that I can think of what's happening is this your for() should be this maybe:
Code:
for (a=0; a<31; a++)

Also, just to make sure.
What this code does is make 30 variables, all with a random number between -1 and 1.
so i[0]=0.4; i[1]=0.9; i[2]=-0.3; etc.



Also, i is such a common variable name,
Are you sure you aren't using it somewhere else? And maybe that's why it doesn't change? because it resets somewhere?
 
S

spoonsinbunnies

Guest
so var b should be a random between -1 and 1 right? Because that's what it's doing.
anyway, you only have to use randomize once somewhere,I have it at the create event of my controller object.

The only thing that I can think of what's happening is this your for() should be this maybe:
Code:
for (a=0; a<31; a++)

Also, just to make sure.
What this code does is make 30 variables, all with a random number between -1 and 1.
so i[0]=0.4; i[1]=0.9; i[2]=-0.3; etc.



Also, i is such a common variable name,
Are you sure you aren't using it somewhere else? And maybe that's why it doesn't change? because it resets somewhere?
yeah for whatever reason putting randomize in level start fixed my problems, yeah Im one of those people who throws in letters for things I don't know how to name, in this case its the weight of the neuron connections, the neurons themselves are also just letters, but don't worry neuron I was promptly named neuron ii so none of that thus far. Anyway thanks for offering advice.
 
Top