CvRNG cvrgn=cvRNG(cvGetTickCount());//cvGetTickCount()以系统的时钟为种子,种子要是可变的,随机值才会发生变化
int r,g,b;
b=cvRandInt(&cvrgn)%255;//想要的值=随机值%限定值。
g=cvRandInt(&cvrgn)%255;
r=cvRandInt(&cvrgn)%255;
我靠,人家一个C函数 rand() 就搞定了。
int bb = rand() & 0xffffff;
CvRNG cvrgn=cvRNG(cvGetTickCount());//cvGetTickCount()以系统的时钟为种子,种子要是可变的,随机值才会发生变化
int r,g,b;
b=cvRandInt(&cvrgn)%255;//想要的值=随机值%限定值。
g=cvRandInt(&cvrgn)%255;
r=cvRandInt(&cvrgn)%255;
我靠,人家一个C函数 rand() 就搞定了。
int bb = rand() & 0xffffff;