mirror of
https://github.com/ringtailsoftware/uvm32.git
synced 2026-06-05 22:43:39 +00:00
Add UVM32_SYSCALL_RAND to get a "true" random number from the host, as I want to play zigtris and not have it be the same every time.
This commit is contained in:
parent
3d83844d5c
commit
d780c4e69d
6 changed files with 18 additions and 1 deletions
|
|
@ -10,7 +10,7 @@ export fn main() void {
|
|||
var gameRunning = true;
|
||||
var lastUpdate:u32 = 0;
|
||||
|
||||
zigtris.gamesetup(console, uvm.millis()) catch |err| {
|
||||
zigtris.gamesetup(console, uvm.rand()) catch |err| {
|
||||
_ = console.print("err {any}\n", .{err}) catch 0;
|
||||
_ = console.flush() catch 0;
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@ pub inline fn millis() u32 {
|
|||
return syscall(uvm32.UVM32_SYSCALL_MILLIS, 0, 0);
|
||||
}
|
||||
|
||||
pub inline fn rand() u32 {
|
||||
return syscall(uvm32.UVM32_SYSCALL_RAND, 0, 0);
|
||||
}
|
||||
|
||||
// dupeZ would be better, but want to avoid using an allocator
|
||||
// this is of course, unsafe...
|
||||
var termination_buf:[128]u8 = undefined;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue