mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[python/urandom] Use Ion::random to seed urandom
This commit is contained in:
@@ -42,3 +42,7 @@ bool micropython_port_interrupt_if_needed() {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int micropython_port_random() {
|
||||
return Ion::random();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ extern "C" {
|
||||
bool micropython_port_vm_hook_loop();
|
||||
bool micropython_port_interruptible_msleep(uint32_t delay);
|
||||
bool micropython_port_interrupt_if_needed();
|
||||
int micropython_port_random();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -89,6 +89,9 @@
|
||||
// Whether to include: randrange, randint, choice, random, uniform
|
||||
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1)
|
||||
|
||||
// Function to seed URANDOM with on init
|
||||
#define MICROPY_PY_URANDOM_SEED_INIT_FUNC micropython_port_random()
|
||||
|
||||
// Make a pointer to RAM callable (eg set lower bit for Thumb code)
|
||||
// (This scheme won't work if we want to mix Thumb and normal ARM code.)
|
||||
#define MICROPY_MAKE_POINTER_CALLABLE(p) (p)
|
||||
|
||||
Reference in New Issue
Block a user