Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.roll isn't random enough in Rakudo #2424

Closed
p6rt opened this issue May 5, 2011 · 8 comments
Closed

.roll isn't random enough in Rakudo #2424

p6rt opened this issue May 5, 2011 · 8 comments

Comments

@p6rt
Copy link

p6rt commented May 5, 2011

Migrated from rt.perl.org#89972 (status was 'resolved')

Searchable as RT89972$

@p6rt
Copy link
Author

p6rt commented May 5, 2011

From @masak

<masak> rakudo​: say <ba da dup dee doodie>.roll(5).join(' ') ~ '!'
<p6eval> rakudo 6ae3c9​: OUTPUT«ba ba ba ba da!␤»
<masak> a slightly elongated Beethoven's fifth :P
<tadzik> rakudo​: say <ba da dup dee doodie>.roll(5).join(' ') ~ '!'
<p6eval> rakudo 6ae3c9​: OUTPUT«ba ba ba ba da!␤»
<tadzik> BOARing!
<masak> huh!? the *same*?
<tadzik> rakudo​: say <ba da dup dee doodie>.roll(5).join(' ') ~ '!'
<p6eval> rakudo 6ae3c9​: OUTPUT«ba ba ba ba da!␤»
<tadzik> rakudo​: say <ba da dup dee doodie>.roll(5).join(' ') ~ '!'
<p6eval> rakudo 6ae3c9​: OUTPUT«ba ba ba ba da!␤»
<masak> something's wrong.
<PerlJam> seriously so
<tadzik> either roll's broken, or we're VERY lucky :)
* masak submits rakudobug
<tadzik> rakudo​: say <ba da dup dee doodie>.roll(5).join(' ') ~ '!'
<p6eval> rakudo 6ae3c9​: OUTPUT«ba ba ba ba da!␤»
<masak> I can't get that jingle out of my head now. make it stop! :P
<PerlJam> rakudo​: say <ba da dup dee doodie>.roll(5).join(' ') ~ '!'
<PerlJam> rakudo​: say <ba da dup dee doodie>.roll(5).join(' ') ~ '!'
<PerlJam> rakudo​: say <ba da dup dee doodie>.roll(5).join(' ') ~ '!'
<p6eval> rakudo 6ae3c9​: OUTPUT«ba ba ba ba da!␤»
<p6eval> rakudo 6ae3c9​: OUTPUT«ba ba ba ba da!␤»
<p6eval> rakudo 6ae3c9​: OUTPUT«ba ba ba ba da!␤»
<masak> the random number seed doesn't get randomized.
<masak> it should.

@p6rt
Copy link
Author

p6rt commented May 10, 2011

From @pmichaud

Now fixed in 72cbadc34cf5cdcb09f8d62a763ede606630f852.

  $ ./perl6 -e 'say ~(1..10).pick(5)'
  2 7 3 8 5
  $ ./perl6 -e 'say ~(1..10).pick(5)'
  10 1 7 6 3
  $ ./perl6 -e 'say ~(1..10).pick(5)'
  9 7 4 1 3

Now we just need some (portable) way to test for this regression in the
future.

Pm

@p6rt
Copy link
Author

p6rt commented May 10, 2011

@pmichaud - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 28, 2011

From @kyleha

I didn't understand at first that the problem is that the random number generator isn't seeded
(ON STARTUP). The best way I can think to test this is to run a separate perl6 process that
executes the code, and then the test script can read and interpret what that separate perl6 spits
out. I haven't done that because it's such a heavyweight solution, bu I have yet to think of
anything better.

@p6rt
Copy link
Author

p6rt commented Nov 19, 2012

From @FROGGS

Hi, what about​:

my $a = qqx{$*EXECUTABLE_NAME -e "print ~(1..10).pick(5)"};
my $b = qqx{$*EXECUTABLE_NAME -e "print ~(1..10).pick(5)"};
my $c = qqx{$*EXECUTABLE_NAME -e "print ~(1..10).pick(5)"};

ok $a != $b || $b != $c, 'yay';

@p6rt
Copy link
Author

p6rt commented Nov 20, 2012

@p6rt
Copy link
Author

p6rt commented Nov 20, 2012

From @FROGGS

Can be closed IMO.

@p6rt
Copy link
Author

p6rt commented Jan 4, 2013

@moritz - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant