This work addresses the localization of dynamic multi-agent systems (MASs) in three-dimensional (3-D) space under random environments (i.e., random packet loss, measurement noise and simultaneous communication noise). It is more practical yet challenging to deal with than static systems under ideal environments. Barycentric coordinates based on the relative-distance are used to characterize the positions between agents. The sign coefficients are introduced to guarantee that the sum of barycentric coordinates is equal to one, thus eliminating the constraint that the agent needs to be located in the convex hull. Using the newly designed iteration-varying gains, a robust distributed estimation method based on iterative learning is proposed. The key to accurate localization is to construct an appropriate approximator via introducing two iterative-varying gains into the localization scheme. The convergence in the sense of mathematical expectation is proved. The simulation examples and experimental results verify the effectiveness of the proposed approach.