Question: Trying to convert some code, but for all my googling I can't figure out how to convert this bit.

```
    float fR = fHatRandom(fRadius);
    float fQ = fLineRandom(fAngularSpread ) * (rand()&1 ? 1.0 : -1.0);
    float fK = 1;

```

This bit

```
(rand()&1 ? 1.0 : -1.0); 

```

I can't figure out.

Answer: 
It's 1 or -1 with 50/50 chance.

An equivalent C# code would be:

```
((new Random().Next(0, 2)) == 0) ? 1.0 : -1.0; 

```

`Next(0,2)` will return either 0 or 1.

If the code gets called a lot you should store the instance of `Random` and re-use it. When you create a new instance of `Random` it gets initialized with a seed that determines the sequence of pseudo-random numbers. In order to have better "randomness" you shouldn't re-initialize the random sequence often.
Either 1.0 or -1.0 with equal chance of either one

rand() generates a number witch is anded with 0x01 i.e. the first bit and depending on if you get a bit or not you get 1.0 or -1.0