标签:style blog color for div log sp c
CCRANDOM_0_1的范围是[0,1)包括0但不包括1
CCRANDOM_0_1() * 1400.0f / 100.0f是0-13
另外每次随机都是相同的数,要随机下种子
srand((unsigned int)time(NULL)); for (int i = 0; i < 100; i++) { //CCRANDOM_0_1是[0,1) //log("%d", (int)(CCRANDOM_0_1()*2)); // int idx = (int)(CCRANDOM_0_1() * 1400.0f / 100.0f); log("%d",idx); }
标签:style blog color for div log sp c
原文地址:http://www.cnblogs.com/as3lib/p/3917849.html