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


Groups > comp.lang.python > #41515

Re: Problem this random seed()

Path csiph.com!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <svenito@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'url:sourceforge': 0.03; 'output': 0.04; 'initialize': 0.05; '&quot;the': 0.07; 'main()': 0.07; 'subject:()': 0.09; 'cc:addr:python-list': 0.10; '(the': 0.15; 'value.': 0.15; '0.0,': 0.16; 'guessing': 0.16; 'reason.': 0.16; 'subject:Problem': 0.16; 'subject:random': 0.16; 'wrote:': 0.17; 'variables': 0.17; 'url:view': 0.18; 'email addr:gmail.com&gt;': 0.20; 'clock': 0.22; 'cc:2**0': 0.23; 'sets': 0.23; 'statement': 0.23; 'idea': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; '---': 0.26; 'appear': 0.26; '(which': 0.26; 'guess': 0.27; 'executing': 0.27; 'execution': 0.27; 'message-id:@mail.gmail.com': 0.27; 'objects': 0.29; 'url:code': 0.29; '"the': 0.29; 'probably': 0.29; 'class': 0.29; 'code': 0.31; 'print': 0.32; 'says': 0.33; 'function.': 0.33; 'values.': 0.33; 'problem': 0.33; 'changed': 0.34; 'received:google.com': 0.34; 'so,': 0.35; 'add': 0.36; 'but': 0.36; 'url:org': 0.36; 'ok,': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'delete': 0.38; 'gives': 0.39; 'your': 0.60; 'mentioned': 0.63; '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=JpMmCWJN8tCYTCrdAEl4BptBlQB8dpkEt2zlg+Q1bU4=; b=TsG0u5HA+cB+1bJddEaG7TkD5wvb8qX6yBLbJxh+bXq7GgjtvfpaomW4E4MFELQX45 zaAXYUrLNKH4WJp5HuDuZ1Kj7b8Z7ScVuqsqMA7QoSd2u+mkR8wxJFmP/40UXw8SO+Ps OtxKAk5YLRBBewNtbASkd9XtJxoJzq2Orkd+ar6l21AZbXBToZyThzQu0xS/RY1UU2iD oya6R1Y6O6q5Le80raWpukWs9IbJCiCepPIJ34ReaZ1aKubOKhE+b/nfbTIwroNWv8VS 20eS17WJBoqDYtRz35CeoceiUR5vUu83FCrraFzpL97v7wWSGrmdadhqQdkPK3wf9Iwc mCqg==
MIME-Version 1.0
X-Received by 10.194.10.202 with SMTP id k10mr3872868wjb.53.1363705544703; Tue, 19 Mar 2013 08:05:44 -0700 (PDT)
In-Reply-To <00329c02-21b7-438e-8551-0f4677d01474@googlegroups.com>
References <c447cffe-964f-4f8e-9931-0c3b5ff9bf6d@googlegroups.com> <be57c21d-7f3c-473b-b553-8a68b84331db@googlegroups.com> <mailman.3495.1363694370.2939.python-list@python.org> <a40ab4ab-a9cb-4a96-a4b6-d4eaa09dd8a4@googlegroups.com> <mailman.3506.1363702753.2939.python-list@python.org> <00329c02-21b7-438e-8551-0f4677d01474@googlegroups.com>
Date Tue, 19 Mar 2013 15:05:44 +0000
Subject Re: Problem this random seed()
From Sven <svenito@gmail.com>
To NZach <nickzacharatos@gmail.com>
Content-Type multipart/alternative; boundary=047d7b5d9b8d92056904d84870db
Cc python-list <python-list@python.org>
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.3516.1363705546.2939.python-list@python.org> (permalink)
Lines 101
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1363705546 news.xs4all.nl 6971 [2001:888:2000:d::a6]:36707
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41515

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 19 March 2013 14:44, NZach <nickzacharatos@gmail.com> wrote:

> OK, i changed the code again. Delete the G class (The purpose of G class
> was to refer to global variables). Add Rnd.seed(12345) in main() function.
> The new code : http://codeviewer.org/view/code:30da
>
> i print the Rnd.expovariate(ArrivalClass.ArvRate).
>
> The output i get be executing the above code is the following :
> ---
> 0.134729071364
> 0.00255530717358
> 0.0886834413113
>
> Result =  0.0571622124959
> 0.134729071364
> 0.00255530717358
> 0.0886834413113
>
> Result =  0.0453791550084
> ---
>
>
> So, the problem is probably with time (which is what @Stev mentioned
> before).
>
> But i still cant understand the reason. From the SimPy documentation :
> http://simpy.sourceforge.net/SimPyDocs/Manuals/SManual.html
> it says for the initialize(): "The initialize statement initialises global
> simulation variables and sets the software clock to 0.0. It must appear in
> your program before any SimPy process objects are activated."
>
> Any idea why that happens
>

I am guessing it's because now gives you the current clock value. Yes,
initialise sets it to 0.0, but on execution now will change to the time
since initialise(), so you will get varying values. That's my best guess

-- 
./Sven

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


Thread

Problem this random seed() NZach <nickzacharatos@gmail.com> - 2013-03-18 18:57 -0700
  Re: Problem this random seed() eli m <techgeek201@gmail.com> - 2013-03-18 19:36 -0700
  Re: Problem this random seed() alex23 <wuwei23@gmail.com> - 2013-03-18 19:51 -0700
    Re: Problem this random seed() NZach <nickzacharatos@gmail.com> - 2013-03-19 03:52 -0700
  Re: Problem this random seed() NZach <nickzacharatos@gmail.com> - 2013-03-19 03:54 -0700
    Re: Problem this random seed() Sven <svenito@gmail.com> - 2013-03-19 11:59 +0000
      Re: Problem this random seed() NZach <nickzacharatos@gmail.com> - 2013-03-19 05:27 -0700
      Re: Problem this random seed() NZach <nickzacharatos@gmail.com> - 2013-03-19 05:27 -0700
      Re: Problem this random seed() NZach <nickzacharatos@gmail.com> - 2013-03-19 06:50 -0700
        Re: Problem this random seed() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-19 14:18 +0000
        Re: Problem this random seed() Sven <svenito@gmail.com> - 2013-03-19 14:19 +0000
          Re: Problem this random seed() NZach <nickzacharatos@gmail.com> - 2013-03-19 07:44 -0700
            Re: Problem this random seed() Sven <svenito@gmail.com> - 2013-03-19 15:05 +0000
            Re: Problem this random seed() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-19 15:09 +0000
              Re: Problem this random seed() Sven <svenito@gmail.com> - 2013-03-19 15:19 +0000
          Re: Problem this random seed() NZach <nickzacharatos@gmail.com> - 2013-03-19 07:44 -0700
      Re: Problem this random seed() NZach <nickzacharatos@gmail.com> - 2013-03-19 06:50 -0700
  Re: Problem this random seed() NZach <nickzacharatos@gmail.com> - 2013-03-19 07:18 -0700
  Re: Problem this random seed() NZach <nickzacharatos@gmail.com> - 2013-03-19 08:23 -0700
    Re: Problem this random seed() NZach <nickzacharatos@gmail.com> - 2013-03-19 08:26 -0700

csiph-web