in reply to Generate a # between 1 and 50 in groups of 5
There is a subtle difference between generating five random numbers and selecting the first five of a randomly ordered set. (The former allows the possibility of duplicates.) Your text implies the former while your code implies the latter. Here is code for the former.
use strict; use warnings; printf "%2d\n", 1 + int(rand 50) for (1..5);
UPDATE: Changed 'code' to 'text' as pointed out by GrandFather.
|
|---|