News for hackers. Stuff that matters.
Re:Lemonade Stand by gweinberg on Wednesday March 13, 2024 @03:04PM (#39695922)
The version I played on the ][+ was clearly not the one shown here, it didn't use a rng. The weather/event sequence was the same every time.
Re:Lemonade Stand by rgmerk on Wednesday March 13, 2024 @04:15PM (#39696848)
It may have been that they used a PRNG and gave it the same initial seed each time.

There were all sorts of odd bits of programming in a lot of these early BASIC games; they were often done by self-taught programmers.

Re:Lemonade Stand by gweinberg on Wednesday March 13, 2024 @04:23PM (#39696963)
Now that I think of it, the computer didn't have a clock, didn't really have any source of entropy. So yeah, that's probably right.
Re:Lemonade Stand by pvg on Wednesday March 13, 2024 @06:14PM (#39698228)
There were memory mapped devices from which you could almost certainly squeeze some out so 'any' is maybe slightly overstated.
Re:Lemonade Stand by rep_lodsb on Thursday March 14, 2024 @04:06AM (#39701466)
Depends on the system. With only one clock source, and no analog input, everything except for user input and disk access time would be completely deterministic.

Not an Apple II expert, but the original IBM PC used a single 14.318MHz crystal to derive every other clock.

Re:Lemonade Stand by ElevenLathe on Thursday March 14, 2024 @07:33AM (#39702541)
There were analog inputs though -- the joystick ports, which were equipped for pong-style potentiometer paddles.
Re:Lemonade Stand by cortesoft on Wednesday March 13, 2024 @04:33PM (#39697089)
Yeah, my first game I ever wrote was a dog racing game in BASIC when I was 9. I didn’t understand PRNG at all or anything about seeds, but I did notice that the same dog won the same race in order.

My solution? At game launch, the game would print “hit space to start the game and then run a right loop over a ‘rand’ call until the user hit space. The entropy was in how long it took you to hit the spacebar!

Re:Lemonade Stand by dmurray on Wednesday March 13, 2024 @06:20PM (#39698280)
I remember this being the recommended way to get random numbers in some programming magazine or textbook, in a BASIC without built-in RAND(). Amazing work to discover this yourself at age 9!

And if you squint, using mouse movements as a source of entropy is still used by some modern programs. Some SSH key generators use it, and I'm sure I've had a Linux installer ask me for it too in recent years. I'm not sure whether this is theatre or whether the OS really can't be relied on to provide suitable entropy itself.

Re:Lemonade Stand by TazeTSchnitzel on Wednesday March 13, 2024 @06:50PM (#39698538)
I think old console games (e.g. for the NES) were like this. You can record the inputs for a speedrun dependant on RNG and replay them on a real console, and so long as the timing is maintained exactly, the RNG outputs will be the same. This has been demonstrated with a tool called TASbot.
Re:Lemonade Stand by boomboomsubban on Wednesday March 13, 2024 @11:24PM (#39700304)
I don't think TASbot is a real tool, it's an avatar for any tool assisted speed run using a variety of tools unique to a specific system or game. See https://tas.bot/wiki/Main_Page
Re:Lemonade Stand by thristian on Wednesday March 13, 2024 @11:10PM (#39700231)
A little of column A, a little of column B.

Generally a key generator does not itself watch for mouse-movements, it just gets random noise from the OS. But the OS gets its random noise from a random number generator, and the random number generator needs to be seeded with genuine randomness. Some CPUs provide a hardware RNG, but older CPUs do not, and some OSs do not trust a hardware RNG implemented in opaque, un-auditable microcode, so they get their randomness from things like the difference between the CPU clock and real-time clock[1] or the relative timing of interrupts... such as those caused by mouse-movement or keyboard key presses.

[1]: https://www.finnie.org/software/twuewand/

Re:Lemonade Stand by cortesoft on Thursday March 14, 2024 @12:21AM (#39700580)
Yeah, sometimes I am surprised by what I was able to figure out as a kid, with no internet or anyone to really ask how to do things. I had books, but mostly just figured stuff out.

I recreated bastardized versions of so many data types that I learned about much later.