You’re just assigning a new CPU array to the same variable names you assigned the GPU arrays to. Your second a_d variable is unrelated to your first a_d variable.
To run rand on the GPU I think you can use rand!(a_d). But the general idea is you have to assign the array and then operate on it. You can use a broadcast a .= x or a function like rand! that has a CUDA.jl version that will dispatch on your gpu array.