I get a pretty vague error (Unknown error) from the above code, but its from the pop's. I suppose thats because shuffle is returning a list (and therefore cannot be pop'd?). Whats an elegant way to get 2 unique random numbers between 1 and x? It seems like it involves an ugly amount of code to do such a trival task :(use List::Util 'shuffle'; my @numbers = (1..10); my $r1 = pop(shuffle(@numbers)); my $r2 = pop(shuffle(@numbers));
In reply to Generating 2 unique random integers (So I can't pop a list...) by uG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |