In reply to Bharat.manvani:
Your problem does not make sense, or is incompletely specified.
You cannot change the size of an associative array, you can only add or delete locations (called a keyed index in SystemVerilog) . Randomization cannot change the key of any location.
This means you either have to populate an associative array with the locations allocated bore calling randomize() which would randomize the array element values, or you can randomize an array of key/value pairs and use post_randomize to construct an associative array from those pairs.