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

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
主站蜘蛛池模板: 邯郸市| 京山县| 平顺县| 晋中市| 东阿县| 丰顺县| 额敏县| 苗栗市| 固阳县| 乌鲁木齐市| 桂东县| 雷波县| 松原市| 景谷| 温泉县| 雷州市| 高青县| 嵊州市| 乐平市| 乌拉特前旗| 崇文区| 新化县| 克东县| 准格尔旗| 湟源县| 江阴市| 乌兰县| 宁陕县| 大荔县| 靖安县| 宁强县| 西乌珠穆沁旗| 金阳县| 宜州市| 阿图什市| 海伦市| 临江市| 东阳市| 双鸭山市| 洮南市| 榆中县|