# C: Modelling errors in a measurement

1. Jun 6, 2013

### six7th

1. The problem statement, all variables and given/known data
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.

2. Jun 6, 2013

### Staff: Mentor

50% spread is a relative error? Or something absolute?
I guess this should be a/100.
This gives a uniform distribution, To get a Gaussian there are many algorithms.