markov chain exercise skeleton
parent
8232946b6e
commit
c2c5fe923e
@ -0,0 +1 @@
|
||||
nightly
|
||||
@ -0,0 +1,16 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "random"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d62d9cce151a97168445d78542558d3bddf6cf99f283c475f2eaf5cc14c364a"
|
||||
|
||||
[[package]]
|
||||
name = "weather-chain"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"random",
|
||||
]
|
||||
@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "weather-chain"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
rand = "0.10.0"
|
||||
@ -0,0 +1,18 @@
|
||||
use rand::Rng;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
enum Weather { Sunny, Rainy }
|
||||
|
||||
struct WeatherChain {
|
||||
/// transition[current][next] = probability
|
||||
transition: [[f64; 2]; 2],
|
||||
}
|
||||
|
||||
impl WeatherChain {
|
||||
fn step(&self, current: Weather, rng: &mut impl Rng) -> Weather { todo!() }
|
||||
fn simulate(&self, start: Weather, steps: usize, rng: &mut impl Rng) -> Vec<Weather> { todo!() }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
todo!()
|
||||
}
|
||||
Loading…
Reference in New Issue