官术网_书友最值得收藏!

  • Perl 6 Deep Dive
  • Andrew Shitov
  • 74字
  • 2021-07-03 00:05:50

Generating a random number

The rand method returns a random number between zero and the given value. Notice that this method is inherited from the Real role (refer to the diagram at the beginning of the Using simple built-in data types section), and the return value is a floating-point number:

say 100.rand;

Running this code a few times results in different values being printed, as you can see here:

70.1530942429978
57.2150256026057
13.7542877975353
94.6395293813437
主站蜘蛛池模板: 定南县| 咸宁市| 定南县| 江城| 胶南市| 稷山县| 新巴尔虎右旗| 博湖县| 鸡泽县| 曲阳县| 太仆寺旗| 调兵山市| 修水县| 安图县| 黔东| 巴林右旗| 松江区| 南召县| 永登县| 广汉市| 井冈山市| 佛教| 广州市| 溧阳市| 苗栗市| 嘉鱼县| 古交市| 甘孜县| 永州市| 松江区| 安龙县| 库车县| 南乐县| 正安县| 商洛市| 闻喜县| 建湖县| 南澳县| 萨嘎县| 裕民县| 柳河县|