I think it would be very important to see how you use rand()
to retrieve the coordinates. What is really surprising is that you only see the pattern in x coordinates, but not in y. If there really was a flaw in rand()
, it should appear in both.
However, I could try to guess where these patterns came from: rand()
, as you know, creates more randomness in high bits than in low bits. Therefore, you should never use modulo to extract a smaller range, because this way you can get only low-bit parts with less randomness.
From this knowledge, I would suggest that you extract the low bits to get the x values ββand high bits to extract the y values. This will give you a much more random pattern along the y axis than along the x axis.
If this is what you are doing, there should be some kind of artifact in your code that causes more randomness along the y axis than along the x axis. Therefore, without seeing your code, it is difficult to say whether this implementation is erroneous.
LiKao source share