RPG attributes generator: Difference between revisions
Content added Content deleted
(→{{header|Perl 6}}: Extracted constants, added names.) |
m (→{{header|zkl}}: formatting) |
||
Line 467: | Line 467: | ||
attrs.clear(); |
attrs.clear(); |
||
do(6){ |
do(6){ |
||
abcd:=(4).pump(List |
abcd:=(4).pump(List,(0).random.fp(1,7)); // list of 4 [1..6] randoms |
||
attrs.append(abcd.sum(0) - (0).min(abcd)); // sum and substract min |
attrs.append(abcd.sum(0) - (0).min(abcd)); // sum and substract min |
||
} |
} |
||
}while((S=attrs.sum(0))<75 or (N=attrs.filter('>=(15)).len())<2); |
}while((S=attrs.sum(0))<75 or (N=attrs.filter('>=(15)).len())<2); |
||
println("Random numbers: %s\ |
println("Random numbers: %s\nSums to %d, with %d >= 15" |
||
.fmt(attrs.concat(","),S,N));</lang> |
.fmt(attrs.concat(","),S,N));</lang> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Random numbers: |
Random numbers: 15,15,7,17,10,13 |
||
Sums to 77 with 3 >= 15 |
|||
</pre> |
</pre> |