产生介于某一返回的随机数的函数 - waiting...'s Blog

产生介于某一返回的随机数的函数

waiting... posted @ 2009年3月02日 22:47 in C/C++ with tags 返回 随机数 函数 上限 下限 上下限 范围 , 1754 阅读

 

  1. // 返回一个介于lower与upper之间的随机数
  2.  
  3. #include <cstdlib>
  4.  
  5. int rand_int(int lower, int upper)
  6. {
  7.         return lower + rand() % (upper - lower + 1);
  8. }

 

 

Avatar_small
AP 10th History Mode 说:
2022年9月17日 22:51 History can guide learners to see trends and processes from a broader, holistic perspective and to understand them. Through History, they come into contact with other cultures and societies and in this way they gain a more holistic understanding of the contemporary world and their place in this broader context. Telugu Medium, AP 10th History Model Paper English Medium & Urdu Medium Students of the State Board can download the AP 10th History Model Paper 2023 Pdf with Answers designed based on the revised syllabus and curriculum of the course. Class teachers and leading institutional experts are designed and suggested the Part-A, Part-B, Part-C, and Part-D exams like SA-1, SA-2, FA-1, FA-2, FA-3, FA-4 along with Assignments.

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee