How to confirm the reason of a bug of '$rand.pload'

In reply to chr_sue:

I got it!
My previous code is coded as a textbook.And now I learn a new method.Thank you!