Seems that is indeed how it was coded back then. If you request several images it gets each individually without checking. Thus the duplicates.
Alternatively you could try the random option of `printImageStatistic()` from the `image_album_statistics` plugin. That works differently internally.