Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: New to Perl: Hashes and int(rand())

by Laurent_R (Abbot)
on Jun 14, 2014 at 08:09 UTC ( #1089879=note: print w/replies, xml ) Need Help??


in reply to New to Perl: Hashes and int(rand())

This is an (untested) example of the code you might want to insert into the program template provided by Ovid in order to populate the %stat_for hash:
foreach my $key (keys %stat_for) { $stat_for{$key} = 2 + int (rand (6)) + int (rand (6)); }
This will populate different random values for each of the three characteristrics (intelligence, strength, dexterity) of your character, because the $key variable will take successively the values of the three caracteristics.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1089879]
help
Chatterbox?
marioroy running LWP::Simple on Cygwin in parallel completes in 1 second. Pre-loading essential modules is necessary only on MSWin32 Re: Crash with ForkManager on Windows.
marioroy LWP::Simple works best with Perl v5.26 on Windows. Any Perl version is fine on Cygwin and Unix.

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2017-09-23 15:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (272 votes). Check out past polls.

    Notices?