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

  • 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
主站蜘蛛池模板: 且末县| 探索| 林周县| 吉木萨尔县| 米易县| 阳城县| 鄄城县| 永善县| 靖江市| 盐城市| 潜山县| 洛宁县| 南华县| 中山市| 马龙县| 西青区| 玉田县| 曲水县| 镇巴县| 小金县| 临潭县| 大邑县| 胶州市| 永和县| 竹山县| 连城县| 通州市| 甘肃省| 紫金县| 襄城县| 马边| 莱阳市| 方正县| 万源市| 丘北县| 彰武县| 双峰县| 浙江省| 崇阳县| 江陵县| 久治县|