Simon Proctor
Sep 6, 2018 · 1 min read

So on my VM at home the first code took 43seconds so in the same ballpark. By using .roll instead of .pick in a loop (roll is like rolling a dice, you can get the same result twice) you get :

perl6 -e 'my @a = "a".."z".list; my @e = (@a.roll(8).join for ^1_000_000); say “P6: @e[0]”;'

Which on my box again comes in at 4 seconds. Of course the realy trick is to make @e a lazy list with gather and take… but that’s cheating for what you want.

    Simon Proctor

    Written by

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade