"Random noise" usually means Gaussian random noise. If you have the
double amplitude = 10.0; // signal amplitude
double SNR = 0.1; // signal-to-noise ratio
default_random_engine engine;
normal_distribution noise(0.0, SNR);
Then just add the noise value to your sine output with:
output = amplitude*( sin(x) + noise(engine) );
I'd have to look up how to get a good Gaussian value from the C rand() function from
Define a function
double urand()
{
.... return -1.0 + 2.0*rand()/RAND_MAX; // uniform: -1.0<=u1<=1.0
}
That's uniform on the interval [-1,1], with standard deviation 1/sqrt(3).
A sum of n variables with standard deviation s will have a standard deviation of s*sqrt(n), so adding 3 of them together will get a somewhat normal (Gaussian) distribution with standard deviaition of 1, so you can output:
amplitude*(sin(x) + SNR*(urand() + urand() + urand()))
...as your noisy sine value.