Can you provide a little bit of code so I can understand you better?

Let's see if I can modify your code (trying to remember D3DX, forgive any goofs please. ):

D3DXVECTOR3 GetRandomVector()
{
// Set these to normalized vectors as appropriate.
// We'll use +z as direction and +y as up vector.
D3DXVECTOR3 dirVec( 0.0f, 0.0f, 1.0f );
D3DXVECTOR3 upVec( 0.0f, 1.0f, 0.0f );
D3DXVECTOR3 vVector;
const float angleRange = D3DX_PI/2.0f; // 45 degree's.
float angle = GetRandMinMax( 0.0f, 2.0f * D3DX_PI ); // Anywhere in the full circle.
float range = GetRandMinMax( 0.0f, tan( angleRange ) );
D3DXVECTOR3 offset = upVector * range;
// Hmm. No D3DX for vector around vector rotation. Bah..
float s = sin( angle );
float c = cos( angle );
D3DXVECTOR3 temp(
offset.x*(dirVec.x*dirVec.x*(1-c)+c) + offset.y * (dirVec.x*dirVec.y*(1-c)-dirVec.z*s) + offset.z*(dirVec.x*dirVec.z*(1-c)+dirVec.y*s),
offset.x*(dirVec.x*dirVec.y*(1-c)+dirVec.z*s) + offset.y*(dirVec.y*dirVec.y*(1-c)+c) + offset.z*(dirVec.y*dirVec.z*(1-c_-dirVec.x*s),
offset.x*(dirVec.x*dirVec.z*(1-c)-dirVec.y*s) + offset.y*(dirVec.y*dirVec.z*(1-c)+dirVec.x*s)+offset.z*(dirVec.z*dirVec.z*(1-c)+c)
);
temp += dirVec;
D3DXVec3Normalize( vVector, &temp );
return vVector;
}

I probably goofed something up in there but it should be pretty close.

In general though, you really should learn the math bits a better, it takes time but everything you do is going to be math related eventually.

**Edited by AllEightUp, 19 May 2013 - 11:58 AM.**