#include<stdlib.h> #include<stdio.h> #include<time.h> int main() { int a[10]; srand((unsigned)time(NULL)); for (int i=0; i<10; i++) { a[i]=rand()%10; printf("%d ",a[i]); } }
博客来源:http://blog.sina.com.cn/s/blog_574f9aa00100rkis.html