Queue of objects

In reply to suresh M:

Hi Suresh,

Problem is with “length” variable.

First time it is randomized in function “pre_randomize” .
Suppose length=5 ; so it will create queue of 5 objects.

Second time it gets randomized when you call “obj1.randomize()”
Suppose this time it is length=9; so code is trying to iterate 9 times while queue has only 5 objects.

Solution:
1).Use post_randomize method instead of using pre_randomize method.
2).Change code to retain value of length obtained during ‘pre_randomize’ method and use this value inside program block ‘for_loop’.

Have a nice day !!