[vcf-midatlantic] Random numbers

Hagstrom, Paul hagstrom at bu.edu
Fri Apr 7 14:42:31 EDT 2017


> On Apr 7, 2017, at 1:05 PM, Evan Koblentz via vcf-midatlantic <vcf-midatlantic at lists.vintagecomputerfederation.org> wrote:
> 
> Got a line in my game to pick random whole numbers between 1-38. I use these numbers to determine the secret spot a player must find.
> 
> It says:
> 
> R=INT(RND(1)*38)+1
> 
> I read about RND in the Apple II programming manual but I determined the exact code from a Google search (stack overflow method...)
> 
> Problem: it's only giving me even numbers. No odd numbers. Why? And how do I fix that?

For what it's worth, a) it shouldn't be giving you only even numbers, and b) I failed to replicate it.

FOR M=0 TO 1:PRINT INT(RND(1)*38)+1:M=0:NEXT

yields plenty of both odd and even numbers for me on an emulated Apple //e (Virtual II) and a real unenhanced //e.  Are you sure that's exactly the line?  What computer/emulator are you running this on?

 -Paul





More information about the vcf-midatlantic mailing list