changed some stuff
This commit is contained in:
@@ -5,4 +5,5 @@ pub mod interrupts;
|
||||
pub mod memory;
|
||||
pub mod render;
|
||||
pub mod serial;
|
||||
pub mod tasks;
|
||||
pub mod tasks;
|
||||
pub mod sysinit;
|
||||
@@ -1,3 +1,4 @@
|
||||
fn init() -> Result<(), ()> {
|
||||
use crate::println;
|
||||
pub fn init() -> Result<(), ()> {
|
||||
Ok(())
|
||||
}
|
||||
@@ -6,4 +6,5 @@ pub fn init() {
|
||||
kernel::interrupts::init_idt();
|
||||
unsafe { kernel::interrupts::PICS.lock().initialize() };
|
||||
x86_64::instructions::interrupts::enable();
|
||||
kernel::sysinit::init().unwrap();
|
||||
}
|
||||
@@ -3,14 +3,16 @@ use alloc::{string::{String, ToString}, vec::Vec};
|
||||
use rand::{Rng, SeedableRng, rngs::SmallRng, RngCore};
|
||||
use spin::Mutex;
|
||||
use lazy_static::lazy_static;
|
||||
use cmos_rtc::{ReadRTC, Time};
|
||||
|
||||
lazy_static! {
|
||||
pub static ref RANDOM: Mutex<SmallRng> = Mutex::new(SmallRng::seed_from_u64(1));
|
||||
pub static ref RANDOM: Mutex<SmallRng> = Mutex::new(SmallRng::seed_from_u64({
|
||||
let mut cmos = ReadRTC::new(0x00, 0x00);
|
||||
let time: Time = cmos.read();
|
||||
time.second as u64 + time.minute as u64 + time.hour as u64 + time.day as u64 + time.month as u64 + time.year as u64
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
pub struct Random;
|
||||
|
||||
impl Random {
|
||||
@@ -28,8 +30,8 @@ impl Random {
|
||||
}
|
||||
|
||||
}
|
||||
pub fn selection<T: Clone>(ls: Vec<T>) -> T {
|
||||
pub fn selection<T: Clone>(ls: &Vec<T>) -> &T {
|
||||
let range = Random::int(0, ls.len() - 1);
|
||||
ls[range as usize].clone()
|
||||
&ls[range as usize]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user