- #1
six7th
- 14
- 0
Homework Statement
I'm currently writing a program that will read in a list of gaussian distributed random numbers as an array and will make a 'measurement', that is they will be assigned to another array with an associated error. This is to try and simulate the communication of Alice to Bob in a continuous variable quantum key distribution protocol.
In such a protocol there will be gaussian noise and therefore Bob will not receive the exact signal that was sent. For example, if there was a 50% spread around Alice's value that Bob could measure, how would I go about doing this?
2. The attempt at a solution
for(i=0;i<=size;i++)
{
double a = (rand() % 100) - 50; //Produces a random number between -50 and 50
bob = alice + (a/10); //Bob makes a measurement with a random error between -0.5 and 0.5
fprintf(gaussBob, "%.4lg %.4lg\n",alice,bob);
}
To me what I've done doesn't seem correct as there is just an addition of a random value between the specified range. Any help is appreciated.