如何将数字更改为随机数? [英] How to change the numbers to random numbers?

查看:87
本文介绍了如何将数字更改为随机数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我想将我的代码数量改为随机或作为一个总和:

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;





我使用带有perl的base64。



我知道如何拨打随机数但我不能把它们放在@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我可以在这个地方添加$ random_number我想要号码被调用,但我不能让它为这个脚本工作。我认为这是因为base64编码。我想手动拨打每个号码分开。



任何人都知道如何让这个工作?



非常感谢。


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.

推荐答案

str = encode_base64 pack ' C *' @ codes ;





我使用带有perl的base64。



我知道如何拨打随机数字,但我不能把它们放在@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
range = 15; my


minimum = 75 ;
my
minimum = 75; my


这篇关于如何将数字更改为随机数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆