We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3bc8588 commit 7e3109fCopy full SHA for 7e3109f
library/std/src/sys/pal/vexos/mod.rs
@@ -21,6 +21,7 @@ pub mod thread_local_key;
21
pub mod time;
22
23
use crate::{arch::asm, ptr::{self, addr_of_mut}};
24
+use crate::hash::{DefaultHasher, Hasher};
25
26
#[cfg(not(test))]
27
#[no_mangle]
@@ -87,6 +88,18 @@ pub fn abort_internal() -> ! {
87
88
}
89
90
91
+fn hash_time() -> u64 {
92
+ let mut hasher = DefaultHasher::new();
93
+ // The closest we can get to a random number is the time since program start
94
+ let time = unsafe {
95
+ vex_sdk::vexSystemHighResTimeGet()
96
+ };
97
+ hasher.write_u64(time);
98
+ hasher.finish()
99
+}
100
+
101
pub fn hashmap_random_keys() -> (u64, u64) {
- (1, 2)
102
+ let key1 = hash_time();
103
+ let key2 = hash_time();
104
+ (key1, key2)
105
0 commit comments