Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'skip:[ 20': 0.03; 'main()': 0.07; 'subject:()': 0.09; 'cc:addr:python-list': 0.10; 'suggest': 0.11; '1234': 0.16; 'fine.': 0.16; 'iteration.': 0.16; 'subject:Problem': 0.16; 'subject:random': 0.16; 'suggesting': 0.16; 'wrote:': 0.17; 'instance': 0.17; 'url:view': 0.18; 'changes': 0.20; 'email addr:gmail.com>': 0.20; 'sorry,': 0.22; 'cc:2**0': 0.23; 'statement': 0.23; 'second': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'creating': 0.26; 'values': 0.26; 'execution': 0.27; 'message- id:@mail.gmail.com': 0.27; 'run': 0.28; 'initialized': 0.29; 'seed': 0.29; 'url:code': 0.29; 'code': 0.31; 'print': 0.32; 'values.': 0.33; 'changed': 0.34; 'received:google.com': 0.34; 'same.': 0.35; 'so,': 0.35; 'url:org': 0.36; 'skip:g 30': 0.36; 'method': 0.36; 'previous': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'where': 0.40; 'first': 0.61; 'time,': 0.62; 'different': 0.63; 'here': 0.65; 'reply': 0.66; 'subject:this': 0.84; '2013': 0.84; 'simulation': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=jhhcpOXkqLX7J5IpcIafNIcMlUO7SE9E8awMBFVBRVI=; b=wor6PFlemhlT/YiZnMv44YE4E3E9ctQmxnF8SkrPnSv2wxl1PsIhBmK8EZ8jYj+HyR /NOQylnWphvl3WsOMunJTZ1GA74CsuHtwGKSF8BhZsZyzY49sZa5DhPk+uSGIvcywSe3 NbDj+BM4uUxkYhm4FKF1TB169MPSZ2gFLQKJDf8SDdz6Ng8AU/kMs0uHkb+y6JL137Mr 8Jb6agu0Pnr8WrtAfXqJZLIvTdz4jUvtUtzvLUeGR/buUgbQMVc9tpNhMLqI0Ka7AwvA 2tQ+Om7YEaEqjHvsECtHwpPSkhOLT1nBzhP5KxiIZMyfsx+UzgHUkoA/OBEdYQqm2bxn Q3Jw== MIME-Version: 1.0 X-Received: by 10.194.123.103 with SMTP id lz7mr3691005wjb.10.1363702750540; Tue, 19 Mar 2013 07:19:10 -0700 (PDT) In-Reply-To: References: Date: Tue, 19 Mar 2013 14:19:10 +0000 Subject: Re: Problem this random seed() From: Sven To: NZach Content-Type: multipart/alternative; boundary=089e0122814206808d04d847cae6 Cc: python-list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 103 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1363702753 news.xs4all.nl 6926 [2001:888:2000:d::a6]:48269 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41504 --089e0122814206808d04d847cae6 Content-Type: text/plain; charset=ISO-8859-1 On 19 March 2013 13:50, NZach wrote: > Sorry, my previous reply was completely wrong. The time is initialized > through the initialize() to 0. So, each time i call main() the simulation > time is initialized to 0. > > I changed the code in order to print and check the values of > > G.Rnd.expovariate(MachineClass.SrvRate) and > G.Rnd.expovariate(ArrivalClass.ArvRate) > > here is the code and the changes i made : > http://codeviewer.org/view/code:30d8 > > The values are not the same. > > The result i take is the following: > > Result from main() call No. 1 is 0.0452927906737 > Result from main() call No. 2 is 0.0588336669949 > 2 > First time Execution of Main Main > [0.07267291894782457, 0.019146562687989536, 0.034780398625615376, > 0.005528912370370478, 0.023636815811338075] > [0.13472907136407936, 0.0025553071735785462, 0.08868344131130483, > 0.05381286556098766, 0.044091180681591464] > Second time Execution of Main > [0.0335704752213292, 0.1321512230812724, 0.16025979406301488, > 0.029210377271523574, 0.006680846943670858] > [0.20642889529587374, 0.047894131266223446, 0.10958802111803392, > 0.02393344456847461, 0.13280785022932287] > In the new code you are creating one instance of G which you seed with 1234 and then calling expovariate on it each time you call main without reseeding. You're only seeding it once and reusing it, so you would get different values. What you had before, where you seeded G.Rnd in the main was fine. I also suggest you change one thing at a time, rather than reworking large parts each iteration. All I was suggesting was a simple print statement in the Run method like you had it before -- ./Sven --089e0122814206808d04d847cae6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On 19 March 2013 13:50, NZach <nickzacharatos@gmai= l.com> wrote:
Sorry, my previous reply was completely wrong. The time is= initialized through the initialize() to 0. So, each time i call main() the= simulation time is initialized to 0.

I changed the code in order to print and check the values of

G.Rnd.expovariate(MachineClass.SrvRate) and G.Rnd.expovariate(ArrivalClass.= ArvRate)

here is the code and the changes i made : http://codeviewer.org/view/code:30d8<= br>
The values are not the same.

The result i take is the following:

Result from main() call No. 1 is 0.0452927906737
Result from main() call No. 2 is 0.0588336669949
2
First time Execution of Main Main
[0.07267291894782457, 0.019146562687989536, 0.034780398625615376, 0.0055289= 12370370478, 0.023636815811338075]
[0.13472907136407936, 0.0025553071735785462, 0.08868344131130483, 0.0538128= 6556098766, 0.044091180681591464]
Second time Execution of Main
[0.0335704752213292, 0.1321512230812724, 0.16025979406301488, 0.02921037727= 1523574, 0.006680846943670858]
[0.20642889529587374, 0.047894131266223446, 0.10958802111803392, 0.02393344= 456847461, 0.13280785022932287]

I= n the new code you are creating one instance of G which you seed with 1234 = and then calling =A0expovariate on it each time you call main without resee= ding. You're only seeding it once and reusing it, so you would get diff= erent values. What you had before, where you seeded G.Rnd in the main was f= ine.

I also suggest you change one thing at a ti= me, rather than reworking large parts each iteration. All I was suggesting = was a simple print statement in the Run method like you had it before


--
./Sven
--089e0122814206808d04d847cae6--