Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello i would like to change the numbers of my code to random or as a sumn:
PERL
my @codes = qw(9 45 180 82 233 134 21 164 166 209 5 217 231 129 192 14);
my $str = encode_base64 pack 'C*', @codes;


Im using base64 with perl.

I know how to call random numbers but i can not put them in the @codes.
PERL
my $range = 15;
my $minimum = 75;
my $random_number = int(rand($range)) + $minimum;

normaly i could add $random_number on the place where i want the number to be called but i cant get it working for this script. I think thats because of the base64 encoding. I would like to manually call each number seperate.

Anyone knows how to get this working?

All help appreciated.
Posted
Comments
Sergey Alexandrovich Kryukov 4-Aug-14 17:48pm    
Why "changing"? Why not putting random values in first place? Any need for those hard-coded 9, 45, 180...? :-)
—SA
dennis2704 4-Aug-14 18:22pm    
I didnt know i could put random values in there. But if possible i would like to use random values in specific ranges if that is possible?
dennis2704 5-Aug-14 15:14pm    
is it possible to do?? and could you help me with it???
Sergey Alexandrovich Kryukov 5-Aug-14 17:48pm    
It's rand($range). What's the problem?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900