-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow changing RND seed #90
Comments
The fixed RND seed on startup is a faithful emulation of a real BBC micro, and at least when writing programs aiming to run on BBCMicroBot you really do want that so the results match what the bot will generate. I suppose there could be an option to randomise it by poking 5 bytes randomly generated by javascript into memory locations 13 to 18 inside the emulator. It needs to happen after BBC BASIC has initialised the RND seed but before the program starts running, so the timing might be a little tricky. Maybe watching for PC being equal to a suitable address inside the BBC BASIC ROM would work. |
Agreed @ojwb ; that's an approach that could work and we support that kind of "poke here in that PC" type thing, but don't expose it in a very simple way currently. |
Or rather the underlying emulator supports it, I should say! |
You can kind of do this inside the emulator actually, e.g.
That initialises the RND seed to 5 bytes from one of the system VIA timers and gives more random results, but you seem to get one of a subset of values if you e.g. |
Currently, RND uses the same seed every time as far as I can tell, as each execution of a program with RND gives the exact same output. Would it be okay to make it so the system time is used as the seed?
The text was updated successfully, but these errors were encountered: