- 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
推薦閱讀
- OpenDaylight Cookbook
- INSTANT OpenCV Starter
- Arduino by Example
- Mastering Selenium WebDriver
- Visual C++數字圖像模式識別技術詳解
- Learning Linux Binary Analysis
- Python神經網絡項目實戰
- Kotlin Standard Library Cookbook
- Linux命令行與shell腳本編程大全(第4版)
- Visual C#.NET程序設計
- Mastering Android Game Development
- 基于ARM Cortex-M4F內核的MSP432 MCU開發實踐
- Java網絡編程實戰
- Babylon.js Essentials
- C++從入門到精通(第6版)