I have three objects. All of them in the create event contain an action each (execute a piece of code):
obj_r01 => r01=0;
obj_r02 => r02=0;
obj_r03 => r03=0;
Image (to clarify what I have tried to explain):
So far so good, but I have one more object that modifies the variables of these other three: obj_control
The obj_control contains two events: create and draw.
crete event (obj_control):
obj_r01.r01=irandom(9); obj_r02.r02=irandom(9); obj_r03.r03=irandom(9); draw event (obj_control):
This event contains three actions, precisely three "execute a piece of code":
piece one:
draw_text(x,y,obj_r01.r01); => applies to obj_r01
piece two:
draw_text(x,y,obj_r02.r02); => applies to obj_r02
piece three:
draw_text(x,y,obj_r03.r03); => applies to obj_r03
The objects are arranged as follows in the room:
In execution this is what happens:
The value of r01 is randomized, but that of r02 and r03 is not. I also tried to modify the obj_control creation event code to:
randomize(); obj_r01.r01=irandom(9); randomize(); obj_r02.r02=irandom(9); randomize(); obj_r03.r03=irandom(9); However the result does not change. With this I could only suspect that the irandom () function can only create a storable random value, would it solve such a problem?
EDIT 1:
I tried putting randomize() only at the beginning of the code as suggested to me by @Philipp and @DH.:
randomize(); obj_r01.r01=irandom(9); obj_r02.r02=irandom(9); obj_r03.r03=irandom(9); But there was no change in the result.
I also did a test to be sure if the value was not even being randomized or if the values of r02 and r03 were being randomized to 0 and for that I modified their values in the creation of each object:
In obj_r02:
r02=10
In obj_r03:
r03=100
The result:
The first value (not surprisingly) was randomized, but the second and third values were not. Thus it is clear that the randomization is not being made or that the draw event is occurring before the radomization of r02 and r03.






randomize()before each call will increase correlation between outputs, rather than decrease it. That's because you've tethered them all to be only one shuffle step away from whatever data source is used to driverandomize(generally the system clock). PRNGs are typically optimized to give good decorrelation in depth (sequential results from the same seed) not in breadth (initial results from adjacent seeds - hash functions are better optimized for this use). What happens if you randomize only before the first roll? \$\endgroup\$