generating random tuples in python
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Mon Apr 20 15:21:24 EDT 2009
per:
> in other words i want the list of random numbers to be arbitrarily
> different (which is why i am using rand()) but as different from other
> tuples in the list as possible.
This is more or less the problem of packing n equal spheres in a cube.
There is a lot of literature on this. You can use a simulated
annealing to find good enough solutions. You just need 15 lines of
code or less. But it's going to be slow if n is not very small. A fast
language (or Psyco) is better for that.
Bye,
bearophile
More information about the Python-list
mailing list