generating random tuples in python
arnodel at googlemail.com
Mon Apr 20 21:52:15 CEST 2009
per <perfreem at gmail.com> writes:
> hi all,
> i am generating a list of random tuples of numbers between 0 and 1
> using the rand() function, as follows:
> for i in range(0, n):
> rand_tuple = (rand(), rand(), rand())
> when i generate this list, some of the random tuples might be
> very close to each other, numerically. for example, i might get:
> (0.553, 0.542, 0.654)
> (0.581, 0.491, 0.634)
> so the two tuples are close to each other in that all of their numbers
> have similar magnitudes.
> how can i maximize the amount of "numeric distance" between the
> elements of this list, but still make sure that all the tuples have
> numbers strictly between 0 and 1 (inclusive)?
To solve your problem, you need to define quantitatively what your
"numeric distance" is.
> 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.
> thank you for your help
More information about the Python-list