Alex Rivera | Logout

How to generate Bad Random Numbers

Asked 2010-11-04T16:15:24.293
10

I'm sure the opposite has been asked many times but I couldn't find any answers on how to generate bad random numbers.

I want to write a small program for cluster analysis and want to generate some random Points for testing. If I would just insert 1000 Points with random coordinates they would be scattered all over the field which would make a cluster analysis worthless.

Is there a simple way to generate Random Numbers which build clusters?

I already thought about either not using random() but random()*random() which generates normally distributed numbers (I think I read this somewhere here on Stack Overflow).

Second approach would be picking a few areas at random and run the point generation again in this area which would of course produce a cluster in this area.

Do you have a better idea?

Edit
Report

2 Answers

2
  • Add an additional dimension to your model.
  • Draw an irregular (i.e. not flat) surface.
  • Generate numbers in the extended space.
  • Discard all numbers which are on one side of the surface.
  • From every number left, drop the additional dimension.
answered 2010-11-04T16:37:24.490
1

Maybe I have misunderstood, but the gnu scientific library (written in c) has many distributions written within it - could you not pick coordinates from the Gaussian/poisson etc from that library?

http://www.gnu.org/software/gsl/manual/html_node/Random-Number-Distributions.html

They provide a simple example with the Poisson distribution from the link, too.

If you need your distribution to be bounded (for example y-coordinate not less than -1) then you can achieve that by rejection sampling from the uniform distribution in the gsl.

Blessings, Tom

answered 2010-11-04T16:57:52.680

Your Answer