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


Groups > comp.lang.python > #92290 > unrolled thread

Re: Python Random vs. Cython C Rand for Dice Rolls

Started byChris Angelico <rosuav@gmail.com>
First post2015-06-08 04:53 +1000
Last post2015-06-08 04:53 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Python Random vs. Cython C Rand for Dice Rolls Chris Angelico <rosuav@gmail.com> - 2015-06-08 04:53 +1000

#92290 — Re: Python Random vs. Cython C Rand for Dice Rolls

FromChris Angelico <rosuav@gmail.com>
Date2015-06-08 04:53 +1000
SubjectRe: Python Random vs. Cython C Rand for Dice Rolls
Message-ID<mailman.272.1433703214.13271.python-list@python.org>
On Mon, Jun 8, 2015 at 4:40 AM, C.D. Reimer <chris@cdreimer.com> wrote:
> PS Z:\projects\programming\python\basic_games\fastdice> python
> test_fastdice.py
>
> TOTAL SPOTS     NUMBER OF TIMES
>
>  2                1389911
>
>  3                2777722
>
>  4                4168248
>
>  5                5553632
>
>  6                6944907
>
>  7                8334670
>
>  8                6945597
>
>  9                5553557
>
>  10               4167485
>
>  11               2775806
>
>  12               1388465
>
> 1.65599989891
>
>
> I had to put the array definition outside of the function declaration, where
> it's automatically initialized to zero in the global space.

Yep, that's one valid way to force them all to zero (per C spec). And
now you're seeing reasonable values. The rand() function may not be
all that great, but it certainly isn't responsible for the bizarre
values you were seeing :)

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web