From f75691fd52ba3dbb7dda4cb8e46365a27009d686 Mon Sep 17 00:00:00 2001 From: Hsiaoming Yang Date: Wed, 26 Nov 2014 19:37:52 +0800 Subject: [PATCH] Use random.sample in AudioCaptcha --- captcha/audio.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/captcha/audio.py b/captcha/audio.py index 098fe97..b0ff334 100644 --- a/captcha/audio.py +++ b/captcha/audio.py @@ -193,8 +193,7 @@ class AudioCaptcha(object): :param length: the return string length. """ - for i in range(length): - yield random.choice(self.choices) + return random.sample(self.choices, length) def load(self): """Load voice data into memory."""