I think setting up the boxes might be easier and faster with something like Array::Shuffle.
Yes. And it would be way faster. My randomizer as probably the least efficient version possible.
The other variant would probably to just generate the array of numbers, then randomly select and splice.
I just wanted to do a qick proof of concept without looking up anything and hand-rolled algos (without modules) so i can easily play with every part to see what happens. I do Perl 40 hours a week at work¹, this one was a just-for-fun little home project without any code quality and/or maintainability requirements ;-)
¹ all to do with Point-of-Sales stuff and financial data. I nearly never get to use rand() based stuff, so i'm a bit rusty in that regard
In reply to Re^2: Proving Veritasiums riddle using Perl
by cavac
in thread Proving Veritasiums riddle using Perl
by cavac
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |