Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: I need help

by Lennotoecom (Pilgrim)
on Mar 12, 2014 at 04:19 UTC ( [id://1077960]=note: print w/replies, xml ) Need Help??


in reply to I need help

map {$a[int(rand(6) + 1)]++} 0 .. 5999;
$a[int(rand(6) + 1)]++} for 0 .. 5999; print "side $_: $a[$_]\n" for 1..6;

Replies are listed 'Best First'.
Re^2: I need help
by Kenosis (Priest) on Mar 12, 2014 at 05:34 UTC

    This is well done, but consider instead:

    $a[int(rand(6) + 1)]++ for 0 .. 5999;

    to avoid using map in a void context, as map may be considered a kind of functor.

      yes, thank you sir.
      got carried away

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1077960]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-16 21:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found