@@ -8,7 +8,6 @@ pub mod Random_ {
88
99 use crate :: Native_ :: { LrcPtr , MutCell } ;
1010 use crate :: NativeArray_ :: Array ;
11- use core:: fmt;
1211
1312 #[ repr( transparent) ]
1413 pub struct Random ( MutCell < RngImpl > ) ;
@@ -62,8 +61,8 @@ pub mod Random_ {
6261 // }
6362 // }
6463
65- impl fmt:: Debug for Random {
66- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
64+ impl core :: fmt:: Debug for Random {
65+ fn fmt ( & self , f : & mut core :: fmt:: Formatter < ' _ > ) -> core :: fmt:: Result {
6766 f. debug_struct ( "Random" ) . finish ( )
6867 }
6968 }
@@ -76,3 +75,52 @@ pub mod Random_ {
7675 LrcPtr :: new ( Random :: new_seeded ( seed) )
7776 }
7877}
78+
79+ // stub implementation of System.Random for when the "random" feature is not enabled
80+ #[ cfg( not( feature = "random" ) ) ]
81+ pub mod Random_ {
82+ use crate :: Native_ :: { LrcPtr , MutCell } ;
83+ use crate :: NativeArray_ :: Array ;
84+
85+ pub struct Random ;
86+
87+ const MSG : & str = "Using System.Random requires enabling the 'random' feature" ;
88+
89+ impl Random {
90+ pub fn new ( ) -> Self {
91+ unimplemented ! ( "{}" , MSG )
92+ }
93+
94+ pub fn new_seeded ( seed : i32 ) -> Self {
95+ unimplemented ! ( "{}" , MSG )
96+ }
97+
98+ pub fn next0 ( & self ) -> i32 {
99+ unimplemented ! ( "{}" , MSG )
100+ }
101+
102+ pub fn next1 ( & self , max_value : i32 ) -> i32 {
103+ unimplemented ! ( "{}" , MSG )
104+ }
105+
106+ pub fn next2 ( & self , min_value : i32 , max_value : i32 ) -> i32 {
107+ unimplemented ! ( "{}" , MSG )
108+ }
109+
110+ pub fn nextDouble ( & self ) -> f64 {
111+ unimplemented ! ( "MSG" )
112+ }
113+
114+ pub fn nextBytes ( & self , buffer : Array < u8 > ) {
115+ unimplemented ! ( "{}" , MSG )
116+ }
117+ }
118+
119+ pub fn new ( ) -> LrcPtr < Random > {
120+ unimplemented ! ( "{}" , MSG )
121+ }
122+
123+ pub fn new_seeded ( seed : i32 ) -> LrcPtr < Random > {
124+ unimplemented ! ( "{}" , MSG )
125+ }
126+ }
0 commit comments