Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31309

Re: how to insert random error in a programming

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'case.': 0.05; 'things.': 0.05; 'python': 0.09; '"a"': 0.09; 'before.': 0.09; 'errors,': 0.09; 'iterate': 0.09; 'cc:addr:python-list': 0.10; 'programmer': 0.11; 'subject:error': 0.11; '"break"': 0.16; '"i\'d': 0.16; 'assignment.': 0.16; 'deprive': 0.16; 'programmer,': 0.16; 'simulate': 0.16; 'subject:programming': 0.16; 'subject:random': 0.16; 'wrote:': 0.17; 'fix': 0.17; 'module': 0.19; 'changes': 0.20; 'trying': 0.21; 'import': 0.21; 'error.': 0.21; 'context.': 0.22; "i'd": 0.22; 'cc:2**0': 0.23; 'insert': 0.23; 'seems': 0.23; 'random': 0.24; 'cc:no real name:2**0': 0.24; 'signed': 0.24; "we'd": 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'appear': 0.26; 'fit': 0.26; 'am,': 0.27; 'sleep': 0.29; 'case,': 0.29; 'summary': 0.29; 'words': 0.29; 'error': 0.30; 'sense': 0.31; '(and': 0.32; 'could': 0.32; 'values.': 0.33; 'problem': 0.33; 'front': 0.33; 'that,': 0.34; 'version': 0.34; 'text': 0.34; 'list': 0.35; 'data,': 0.35; 'add': 0.36; 'but': 0.36; 'possible': 0.37; 'beyond': 0.37; 'level': 0.37; 'subject:: ': 0.38; 'brief': 0.38; 'some': 0.38; 'description': 0.39; 'takes': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'end': 0.40; 'your': 0.60; 'easy': 0.60; 'most': 0.61; 'first': 0.61; 'night': 0.62; 'series': 0.63; 'more': 0.63; 'response.': 0.67; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'virus.': 0.71; 'reply-to:no real name:2**0': 0.72; 'max.': 0.84; 'presumably': 0.84; 'received:74.208.4.194': 0.84; 'dozen': 0.91; 'dream': 0.95
Date Mon, 15 Oct 2012 10:21:34 -0400
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0
MIME-Version 1.0
To Debashish Saha <silideba@gmail.com>
Subject Re: how to insert random error in a programming
References <CA+b=61AiVYehyGbFyvyTqsfZeio1NoWKtw1SwJV_r_MZ1BcVwA@mail.gmail.com>
In-Reply-To <CA+b=61AiVYehyGbFyvyTqsfZeio1NoWKtw1SwJV_r_MZ1BcVwA@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:lHWnGrxDS4FhjWCxWKxcvElFH+pWHQB8PVXYpdAsnNe zXQLdcFRvwZ8xei9EXFS4N1kIZ0Y2kQAoT+OeX58EomchPKMW/ VkKf7uVNxf3uTvScHAF/gXr+QfENaQ3WGUb/9lT4DGeBGe2j3p 0pFB6Mph5jTAEbY7P7OhZJrp8BrlKRCnpAwrh2CEJnddfHll4H 3diq250MzfXMExpzSa7o+JlENe7WcfYjZUlWKl7EgWJ3lsG85t PEMchk3HqBNdKqlVVqonK8nyy58ipn874TQ/Zm5Kpnrkiobugx 4ykwbpxS4f6BAito5Kgk3YFjfUosNdMxOQAjY7M1U0DBUli/g= =
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To d@davea.name
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.2211.1350310917.27098.python-list@python.org> (permalink)
Lines 46
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1350310918 news.xs4all.nl 6872 [2001:888:2000:d::a6]:47484
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:31309

Show key headers only | View raw


On 10/15/2012 09:55 AM, Debashish Saha wrote:
> how to insert random error in a programming?

I don't see how this phrase makes any sense without a lot more context. 
If I add the words "I'd like to know" in front of the phrase, and
"session."  at the end (and add the word "a" as appropriate), the best
answer I'd come up with is to deprive the programmer of a lot of sleep
the night before.

If I just take the words in the phrase, and try to dream up the possible
ways they could be meant...

For example, perhaps you have a series of data, taken from some
experiment, and you want to "break" the data, to make it appear more
random (to fit the model less well).  You might just want to iterate
over the sample twice, once to calculate the average, min, and max. 
Then you might add to each sample a random signed value with a
distribution based on those three values.

Or you might be a teacher with a "perfect program," and you want to
(programmatically) change it slightly, and see how long it takes your
students to find the introduced error.  This seems to me to be an
extremely hard problem in the general case, though pretty easy for a
human.  Problem is that most random text changes will presumably cause
compile errors, or "not defined".  And those are trivial to find and fix
for an experienced programmer, though first year students might need the
practice.

Or you might be trying to get your module to simulate various errors,
randomly chosen.  In which case, see Chris's or jean-Michel's response.

Or you might be trying to cause other applications to crash, because
you're pretending to be a virus.

Or a dozen other things.

You get the random module by    import random.   But beyond that, we'd
have to understand your use case.  Start by mentioning Python version
and OS. Then give a brief summary of your level of experience in Python
and in other langugages.  Then list the description on the homework
assignment.

-- 

DaveA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: how to insert random error in a programming Dave Angel <d@davea.name> - 2012-10-15 10:21 -0400

csiph-web