blob: 6db12d2b8e82fd7df1e5ccd5f354892fba8515b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [pycrypto] Issue with the new random.choice() unit test
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20Issue%20with%20the%20new%20random.choice%28%29%20unit%20test&In-Reply-To=4D23AC1E.2000509%40amberfisharts.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="000380.html">
<LINK REL="Next" HREF="000382.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[pycrypto] Issue with the new random.choice() unit test</H1>
<B>Thorsten Behrens</B>
<A HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20Issue%20with%20the%20new%20random.choice%28%29%20unit%20test&In-Reply-To=4D23AC1E.2000509%40amberfisharts.com"
TITLE="[pycrypto] Issue with the new random.choice() unit test">sbehrens at gmx.li
</A><BR>
<I>Wed Jan 5 07:01:00 CST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="000380.html">[pycrypto] Issue with the new random.choice() unit test
</A></li>
<LI>Next message: <A HREF="000382.html">[pycrypto] Issue with the new random.choice() unit test
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#381">[ date ]</a>
<a href="thread.html#381">[ thread ]</a>
<a href="subject.html#381">[ subject ]</a>
<a href="author.html#381">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>On 1/4/2011 6:24 PM, Lorenz Quack wrote:
><i> Well, this problem exist in all your random test although it is indeed
</I>><i> unlikely that one will hit the others.
</I>True. It also exists in all other random tests we have, in one form or
another.
><i> random tests. They all use random.randrange which in turn uses getrandbits.
</I>><i> So if you want to go for *real* tests those functions should be the focus.
</I>Aye. Real tests for those would be good, given the importance of
randomness in crypto.
I don't think I'm tackling that anytime soon, though.
><i> * You don't need to create the seq randomly or do you? wouldn't range(500) suffice?
</I>It doesn't have to be random. I changed it to range(10000). Gets rid of
the too-too-likely collision, as well.
><i> * I find the way you fixed the shuffle function rather odd (good catch, though)
</I>><i> my suggestion would be
</I>><i> or even shorter
</I>><i> for i in xrange(len(x)):
</I>><i> x[i] = items.pop(self.randrange(len(items)))
</I>That looks a lot more pythonic. Thanks, I've made that change. I'll hold
off on yet-another-pull-request though, poor Dwayne. :)
Do you have any ideas on the ailing AllOrNothing.py and random.sample on
Python 2.1? I haven't dug into those yet beyond
noting that they have issues, exposed by the new unit tests.
Yours
Thorsten
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="000380.html">[pycrypto] Issue with the new random.choice() unit test
</A></li>
<LI>Next message: <A HREF="000382.html">[pycrypto] Issue with the new random.choice() unit test
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#381">[ date ]</a>
<a href="thread.html#381">[ thread ]</a>
<a href="subject.html#381">[ subject ]</a>
<a href="author.html#381">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">More information about the pycrypto
mailing list</a><br>
</body></html>
|