Artwork

Content provided by Jay Versluis. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Jay Versluis or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.
Player FM - Podcast App
Go offline with the Player FM app!

How to generate Lottery Numbers on the Commodore 64

10:41
 
Share
 

Archived series ("Inactive feed" status)

When? This feed was archived on September 09, 2023 23:10 (1y ago). Last successful fetch was on April 01, 2023 17:45 (1+ y ago)

Why? Inactive feed status. Our servers were unable to retrieve a valid podcast feed for a sustained period.

What now? You might be able to find a more up-to-date version using the search function. This series will no longer be checked for updates. If you believe this to be in error, please check if the publisher's feed link below is valid and contact support to request the feed be restored or if you have any other concerns about this.

Manage episode 215546549 series 2427271
Content provided by Jay Versluis. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Jay Versluis or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.

In this episode I’ll demonstrate how to draw random lottery numbers on a Commodore 64. The secret sauce here is not only the RND function to generate random numbers, but also two loops inside each other that prevent the same number from coming up more than once.

Here’s the lottery generator code:

10 x=rnd(-ti) 20 for i=1 to 6 30 rn=int(rnd(1)*49)+1 40 for j=1 to i 50 if n(j)=rn then 30 60 next j 70 n(i)=rn 80 next i 100 print 110 for i=1 to 6 120 print n(i); 130 next 140 print 199 end

To adapt this listing to match your local lottery, change line 20 to the amount of numbers to be drawn from your pool (6 in my example), and change the value in line 30 to match the size of your pool (49 in my example).

Any questions, please let me know below.

Happy retro hacking!

  continue reading

16 episodes

Artwork
iconShare
 

Archived series ("Inactive feed" status)

When? This feed was archived on September 09, 2023 23:10 (1y ago). Last successful fetch was on April 01, 2023 17:45 (1+ y ago)

Why? Inactive feed status. Our servers were unable to retrieve a valid podcast feed for a sustained period.

What now? You might be able to find a more up-to-date version using the search function. This series will no longer be checked for updates. If you believe this to be in error, please check if the publisher's feed link below is valid and contact support to request the feed be restored or if you have any other concerns about this.

Manage episode 215546549 series 2427271
Content provided by Jay Versluis. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Jay Versluis or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.

In this episode I’ll demonstrate how to draw random lottery numbers on a Commodore 64. The secret sauce here is not only the RND function to generate random numbers, but also two loops inside each other that prevent the same number from coming up more than once.

Here’s the lottery generator code:

10 x=rnd(-ti) 20 for i=1 to 6 30 rn=int(rnd(1)*49)+1 40 for j=1 to i 50 if n(j)=rn then 30 60 next j 70 n(i)=rn 80 next i 100 print 110 for i=1 to 6 120 print n(i); 130 next 140 print 199 end

To adapt this listing to match your local lottery, change line 20 to the amount of numbers to be drawn from your pool (6 in my example), and change the value in line 30 to match the size of your pool (49 in my example).

Any questions, please let me know below.

Happy retro hacking!

  continue reading

16 episodes

All episodes

×
 
Loading …

Welcome to Player FM!

Player FM is scanning the web for high-quality podcasts for you to enjoy right now. It's the best podcast app and works on Android, iPhone, and the web. Signup to sync subscriptions across devices.

 

Quick Reference Guide