-2

Is it a good idea (In terms of quality of the number generated and CPU time required) to use Python's(2.7) default(Mersenne Twister) random() function as the random number generator for Kernighan–Lin algorithm? Is there some better way to do it?

Also, in same context, how would random() function work for generating numbers between 0 and 1 for Simulated Annealing algorithm?

Karthik
  • 5
  • 3

1 Answers1

1

Mersenne twister is a reputable generator used by many languages. It's almost certainly better to use than anything you might try to cobble together on your own, unless you have a PhD background in probability, statistics, number theory, and numeric algorithms.

How would the random() function work? Invoke it every time you want a random number, its return value on each invocation is one sample/observation from the U(0,1) distribution.

pjs
  • 18,696
  • 4
  • 27
  • 56