ERROR: UndefRefError: access to undefined reference

How to eliminate this error
ERROR: UndefRefError: access to undefined reference

a = 280
A = 1:a
for a in A 
         RandDeviation[a] = rand()
     end

It looks that more context is needed to solve this question. I would expect an UndefVarError if RandDeviation were an undefined variable. But if what you get is an UndefRefError is because there is some object there with an undefined field you are trying to access.

What’s typeof(RandDeviation)?