The goal is not well-defined here. If the goal is to generate uniformly-distributed points in a circle then this algorithm is wrong, but it’s not clear that’s actually what they want.
Generating a spectrum with a given magnitude distribution and uniform phase distribution is pretty common (at least in audio).