Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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

by Laurent_R (Canon)
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1089879]
[Corion]: I stay home today as preventative measure to not really get a cold. On the upside, I can sit on the balcony in the sun, and it isn't that cold, at least once I don a thick coat :)

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2018-03-21 11:06 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (267 votes). Check out past polls.