hgext3rd/topic/randomname.py
changeset 4754 75307f276a79
parent 4186 11b12ea01d1e
child 4814 48b30ff742cb
child 4813 dd68ce259708
--- a/hgext3rd/topic/randomname.py	Fri Jul 12 17:02:35 2019 -0700
+++ b/hgext3rd/topic/randomname.py	Wed Jul 17 11:45:37 2019 -0700
@@ -1005,6 +1005,9 @@
 ]
 
 def randomtopicname(ui):
+    # Re-implement random.choice() in the way it was written in Python 2.
+    def choice(things):
+        return things[int(len(things) * random.random())]
     if ui.configint("devel", "randomseed"):
         random.seed(ui.configint("devel", "randomseed"))
-    return random.choice(adjectives) + "-" + random.choice(animals)
+    return choice(adjectives) + "-" + choice(animals)