Code Giving "Randomizion Failure" when running on Quesa Sim Tool

In reply to dave_59:

Thanks a lot !
Replacing randc by rand ,really worked out for me.
But just a little confusion left is , how it will prevent previously used address from being chosen as now i am using rand instead of randc.