Posted 28 January 2012 - 02:58
So you don't want anything random at all (otherwise your objective, placing ellipses along the entire axis, makes no sense). If you wanted random numbers, you would want to generate a uniform distribution; but that provides no guarantee that the ellipses won't be bunched up (since random numbers, by definition, have absolutely no guarantee about their distribution in a range. In other words, if you're generating pseudorandom numbers in the range 0 - 1000, there's no way to guarantee that they won't all end up in the range 0 - 100 without introducing bias). The C++11 standard has a Random spec that allows for introducing these kinds of biases. I'm sure there's a C# library to do so, but I'm pretty sure the .NET Framework doesn't have something like that natively.
One way to do what you want is to divide your range (0-1000) into N blocks (where N is the number of ellipses). Then for each block, generate a pseudorandom spot in that block's range and place an ellipse there. Then move to the next block. This is pretty much what Ntrstd said.
So if you have 10 ellipses, generate a number between 0 and 100 and place an ellipse there. Then generate a number between 100 and 200 and place an ellipses there... and so on. No need to keep track of occupied positions and it guarantees a biased, relatively-even distribution. It also doesn't require some third-party library.
Alternatively, you could put, say, 5 of those 10 ellipses in the above quasi-even distribution and then place the rest anywhere in the range (0-1000) by generating uniformly-distributed pseudorandom numbers in that entire range.