Click here to Skip to main content
13,287,834 members (50,884 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hello i would like to change the numbers of my code to random or as a sumn:
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.
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 4-Aug-14 5:18am
Comments
   
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???
   
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.171207.1 | Last Updated 4 Aug 2014
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100