This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# discretised ornstein-uhlenbeck | |
ou <- function(steps, theta = 1.0, mu = 1.2, sigma = 0.3, dt = 0.01) { | |
x <- rep(NA, steps+1) | |
x[1] = 0 | |
for(i in 2:(steps+1)) { | |
x[i] = x[i-1] + theta * (mu - x[i-1]) * dt + sigma * sqrt(dt) * rnorm(1); | |
} | |
return(x) | |
} | |
# ~~2 years of simulated data if you account for weekends and holidays |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <array> | |
#include <chrono> | |
#include <iostream> | |
#include <random> | |
#include <vector> | |
void generate_array(std::vector<int>& arr, std::mt19937& gen) { | |
std::uniform_int_distribution<> dis(0, 99); | |
for (int & i : arr) { | |
i = dis(gen); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <chrono> | |
#include <iostream> | |
#include <vector> | |
constexpr size_t kPeople = 10000; | |
constexpr size_t kLowBoundAge = 1; | |
constexpr size_t kHighBoundAge = 100; | |
constexpr size_t kAgeLen = kHighBoundAge - kLowBoundAge; | |
int main() |