File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ extern "C" {
34
34
buf : * const u8 ,
35
35
count : u32 ,
36
36
) ;
37
- pub fn sys_rand ( recv_buf : * mut u32 , words : usize ) ;
37
+ pub fn sys_rand ( recv_buf : * mut u8 , words : usize ) ;
38
38
pub fn sys_panic ( msg_ptr : * const u8 , len : usize ) -> !;
39
39
pub fn sys_log ( msg_ptr : * const u8 , len : usize ) ;
40
40
pub fn sys_cycle_count ( ) -> usize ;
Original file line number Diff line number Diff line change @@ -85,5 +85,12 @@ pub fn abort_internal() -> ! {
85
85
}
86
86
87
87
pub fn hashmap_random_keys ( ) -> ( u64 , u64 ) {
88
- ( 1 , 2 )
88
+ let mut buf = [ 0u8 ; 16 ] ;
89
+ unsafe {
90
+ abi:: sys_rand ( buf. as_mut_ptr ( ) , buf. len ( ) ) ;
91
+ } ;
92
+
93
+ let a = u64:: from_le_bytes ( buf[ 0 ..8 ] . try_into ( ) . unwrap ( ) ) ;
94
+ let b = u64:: from_le_bytes ( buf[ 8 ..16 ] . try_into ( ) . unwrap ( ) ) ;
95
+ ( a, b)
89
96
}
You can’t perform that action at this time.
0 commit comments