I see the following code in an NVidia matrix program and a program from my instructor. When I look at this code I know I am doing something stupid, so could someone please explain to me what I am doing wrong? When I change the rand
to a constant all I see is 0
for data[i]
, and when I try to view rand
I seem to see only about 4 different values.
void randomInit(float* data, int size)
{
for (int i = 0; i < size; ++i) {
data[i] = 1;//rand() / (float)RAND_MAX;
printf("%d %d\n",i, data[i]);
}
}
Thank you for any help.