- 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
推薦閱讀
- Boost.Asio C++ Network Programming(Second Edition)
- SoapUI Cookbook
- VSTO開發入門教程
- C語言程序設計實踐教程
- Quarkus實踐指南:構建新一代的Kubernetes原生Java微服務
- Big Data Analytics
- Cocos2d-x學習筆記:完全掌握Lua API與游戲項目開發 (未來書庫)
- 劍指Java:核心原理與應用實踐
- 算法超簡單:趣味游戲帶你輕松入門與實踐
- Build Your Own PaaS with Docker
- C++標準庫(第2版)
- Mastering VMware Horizon 6
- Mastering Java 11
- IBM Cognos 10 Report Studio Cookbook(Second Edition)
- 研發質量保障與工程效率