Add randomness to the initial conditions
This commit is contained in:
		@@ -5,6 +5,9 @@ use std::iter::repeat;
 | 
			
		||||
use std::thread::sleep;
 | 
			
		||||
use std::time::Duration;
 | 
			
		||||
 | 
			
		||||
use rand::thread_rng;
 | 
			
		||||
use rand::Rng;
 | 
			
		||||
 | 
			
		||||
use pixelfoo::color::Color;
 | 
			
		||||
 | 
			
		||||
type Frame = Vec<Vec<Color>>;
 | 
			
		||||
@@ -28,6 +31,8 @@ fn main() -> std::io::Result<()> {
 | 
			
		||||
    let arg = args[3].parse::<usize>().unwrap_or(DEFAULT_ARG);
 | 
			
		||||
    eprintln!("screen size {}x{}, arg {}", x_size, y_size, arg);
 | 
			
		||||
 | 
			
		||||
    let mut rng = thread_rng();
 | 
			
		||||
 | 
			
		||||
    let t_frame = 0.040; // s
 | 
			
		||||
    let delay = Duration::new(0, (1_000_000_000.0 * t_frame) as u32);
 | 
			
		||||
 | 
			
		||||
@@ -56,7 +61,7 @@ fn main() -> std::io::Result<()> {
 | 
			
		||||
    let b = 27.0;
 | 
			
		||||
    let c = 8.0 / 3.0;
 | 
			
		||||
 | 
			
		||||
    let mut x = 1.0;
 | 
			
		||||
    let mut x = rng.gen::<f64>() - 0.5;
 | 
			
		||||
    let mut y = 0.0;
 | 
			
		||||
    let mut z = zc;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user