make_float2 returns struct filled with 1s

Hey all. I am trying to create a float2 using make_float2, but the struct that is being returned has members with values equal to 1.

Here is the code I am using:

[codebox]float2 make_random_float2(){

float2 t = make_float2( (rand() / RAND_MAX + 1.0f),(rand() / RAND_MAX + 1.0f));

std::cout << t.x << " " << t.y << std::endl;

return t;

}

[/codebox]

This code consistently prints “1 1”. Any ideas?

Thanks!

Stupid question. RAND_MAX is an int – rand() / RAND_MAX --> 0, which means I always get 1. Sorry for the stupid question