in reply to random variable declaration based on given count

'I need to... declare the random variable based on the given count'. That 1) can't work when you 'use strict' 2) you don't need to do that. Also, this
$var.$n = $n;
makes compiler crash. Maybe try to tell us what you're really trying to do, and why. How about some examples.