Skip to content

Instantly share code, notes, and snippets.

import matplotlib.pylab as plt
import numpy as np
A = 0.8
f0 = 1000
phi = np.pi / 2
fs = 44100
t = np.arange(-0.002, 0.002, 1.0 / fs)
x = A * np.cos(2 * np.pi * f0 * t + phi)
#include <iostream> // for cin, cout
#include <time.h> // for clock_gettime
#include <cstdlib> // for rand, srand
using namespace std;
// Function to generate a number from [-bound, bound]
template <typename T>
T GenerateRandomNumber(double bound)
{
#include <iostream> // for cin, cout
#include <time.h> // for clock_gettime
#include <cstdlib> // for rand, srand
using namespace std;
// Function to generate a number from [-bound, bound]
template <typename T>
T GenerateRandomNumber(double bound)
{