Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43353
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'scripts': 0.03; 'output': 0.05; 'apps,': 0.07; 'corrections': 0.09; 'quiet': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:script': 0.09; 'wrong,': 0.09; 'random': 0.14; 'benjamin': 0.16; 'components.': 0.16; 'does,': 0.16; 'expert,': 0.16; 'goes...': 0.16; 'indirectly': 0.16; 'instead:': 0.16; 'kern': 0.16; 'realising': 0.16; 'reboot': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:random': 0.16; 'underlying': 0.16; 'wrote:': 0.18; '(where': 0.19; "hasn't": 0.19; 'thu,': 0.19; '>>>': 0.22; 'header :User-Agent:1': 0.23; 'interpret': 0.24; 'typical': 0.24; 'url:dev': 0.24; "i've": 0.25; 'source': 0.25; 'script': 0.25; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'external': 0.29; 'robert': 0.30; "i'm": 0.30; 'software,': 0.31; 'url:wiki': 0.31; '+0100,': 0.31; 'continually': 0.31; "d'aprano": 0.31; 'lot.': 0.31; 'steven': 0.31; 'url:wikipedia': 0.31; 'run': 0.32; 'running': 0.33; 'sources': 0.33; 'could': 0.34; 'but': 0.35; 'really': 0.36; 'doing': 0.36; 'url:org': 0.36; 'operating': 0.37; 'e.g.': 0.38; 'machines': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'generating': 0.39; 'moving': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'received:org': 0.40; 'called': 0.40; 'users': 0.40; 'how': 0.40; 'even': 0.60; 'is.': 0.60; 'numbers': 0.61; 'skip:n 10': 0.64; 'our': 0.64; 'grab': 0.64; 'networking': 0.64; 'provide': 0.64; 'more': 0.64; 'world': 0.66; 'here': 0.66; 'minutes': 0.67; 'believe': 0.68; 'of:': 0.68; 'electrical': 0.74; 'special': 0.74; 'eco': 0.84; 'noise': 0.84; 'oscar': 0.84; 'received:202.71': 0.84; 'subject:long': 0.84; 'terrible': 0.84; 'thermal': 0.84; 'subject:very': 0.91; '2013': 0.98 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Robert Kern <robert.kern@gmail.com> |
| Subject | Re: performance of script to write very long lines of random chars |
| Date | Thu, 11 Apr 2013 16:49:07 +0530 |
| References | <24dc619b-7abd-4be3-aa92-f858eb4ab85f@n4g2000yqj.googlegroups.com> <51666aae$0$29977$c3e8da3$5496439d@news.astraweb.com> <mailman.453.1365673692.3114.python-list@python.org> <51669576$0$29977$c3e8da3$5496439d@news.astraweb.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | 202.71.137.182 |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 |
| In-Reply-To | <51669576$0$29977$c3e8da3$5496439d@news.astraweb.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.461.1365679158.3114.python-list@python.org> (permalink) |
| Lines | 52 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1365679158 news.xs4all.nl 2699 [2001:888:2000:d::a6]:39719 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:43353 |
Show key headers only | View raw
On 2013-04-11 16:20, Steven D'Aprano wrote: > On Thu, 11 Apr 2013 10:47:43 +0100, Oscar Benjamin wrote: > >> On 11 April 2013 08:47, Steven D'Aprano >> <steve+comp.lang.python@pearwood.info> wrote: >> >>> One thing to be aware of: urandom may run out of entropy, and then it >>> will slow down a lot. If you don't care about cryptographic randomness, >>> you could use this instead: >> >> Reading this I'm realising that I don't really know what os.urandom is. >> How exactly is it generating random numbers and what do you mean by it >> running out of entropy? > > I am not an expert, but here goes... > > Some (most?) modern operating systems provide a cryptographically strong > source of non-deterministic randomness. The non-deterministic part comes > from external "stuff", which is called "entropy". Typical sources of > entropy include network events, user key-presses, moving the mouse, and > (presumably in machines with special hardware), even thermal noise in > electrical components. > > If the OS hasn't collected enough entropy, urandom can block until it > has. This can be a problem, e.g. I've experienced issues where scripts > relying indirectly on urandom that run at system reboot can block for > minutes at a time, waiting for entropy. If those scripts run before the > networking software, and before any users log in and start running apps, > the script can block forever waiting for entropy that never arrives. > > (Where "forever" == "70 minute boot times".) > > Entropy is used and discarded, so urandom needs the OS to continually > replenish the amount of entropy. Under normal circumstances, this it > does, but if you grab lots of urandom output on a system which is > otherwise quiet and not doing anything, it could run out. > > If I've got any of this wrong, corrections will be gratefully acceptable. Just one important thing: os.urandom() does not block to wait for more entropy. Only os.random() does. http://en.wikipedia.org/wiki//dev/random -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
performance of script to write very long lines of random chars gry <georgeryoung@gmail.com> - 2013-04-10 18:21 -0700
Re: performance of script to write very long lines of random chars Chris Angelico <rosuav@gmail.com> - 2013-04-11 11:45 +1000
Re: performance of script to write very long lines of random chars Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-11 05:33 +0000
Re: performance of script to write very long lines of random chars Chris Angelico <rosuav@gmail.com> - 2013-04-11 15:53 +1000
Re: performance of script to write very long lines of random chars Michael Torrie <torriem@gmail.com> - 2013-04-10 19:52 -0600
Re: performance of script to write very long lines of random chars gry <georgeryoung@gmail.com> - 2013-04-10 19:40 -0700
Re: performance of script to write very long lines of random chars Chris Angelico <rosuav@gmail.com> - 2013-04-11 13:14 +1000
Re: performance of script to write very long lines of random chars MRAB <python@mrabarnett.plus.com> - 2013-04-11 04:09 +0100
Re: performance of script to write very long lines of random chars Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-11 07:47 +0000
Re: performance of script to write very long lines of random chars Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-04-11 10:47 +0100
Re: performance of script to write very long lines of random chars Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-11 10:50 +0000
Re: performance of script to write very long lines of random chars Robert Kern <robert.kern@gmail.com> - 2013-04-11 16:49 +0530
Re: performance of script to write very long lines of random chars Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-04-11 13:05 +0100
Re: performance of script to write very long lines of random chars Robert Kern <robert.kern@gmail.com> - 2013-04-11 19:06 +0530
Re: performance of script to write very long lines of random chars Chris Angelico <rosuav@gmail.com> - 2013-04-11 23:56 +1000
Re: performance of script to write very long lines of random chars Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-04-11 10:47 +0100
csiph-web