阅读:2437回复:7
VC++下,产生随机数的函数是哪个?
没有工具书和msdn,请帮忙!
至少30分。 |
|
最新喜欢:![]()
|
沙发#
发布于:2004-07-15 16:34
rand()
|
|
板凳#
发布于:2004-07-15 16:46
msdn,
here:http://msdn.microsoft.com/vstudio/downloads/updates/sp/vs6/sp5/sp5_cn.aspx |
|
地板#
发布于:2004-07-15 16:56
就是rand()! :)
|
|
|
地下室#
发布于:2004-07-15 16:58
就是rand()! :) easy! |
|
5楼#
发布于:2004-07-15 18:06
Example
/* RAND.C: This program seeds the random-number generator * with the time, then displays 10 random integers. */ #include <stdlib.h> #include <stdio.h> #include <time.h> void main( void ) { int i; /* Seed the random-number generator with current time so that * the numbers will be different every time we run. */ srand( (unsigned)time( NULL ) ); /* Display 10 numbers. */ for( i = 0; i < 10;i++ ) printf( " %6d\n", rand() ); } |
|
|
6楼#
发布于:2004-07-15 21:23
谢谢大家了,特别是钱粮贴!
|
|
|
7楼#
发布于:2004-07-16 07:57
srand()
rand() vc下用标准的C库函数都是可以的。 |
|