Jump to content
IGNORED

Need Help With Random Number Generation


Peter G

Recommended Posts

One of the tricks I picked up while coding in C++ was putting "monitors" on the screen (my term). They simply showed the value a variable held, making it easier to see what the program logic was doing behind the scenes. So you can guess how thrilled I was to find out the score display could be used to do just that.

 

I'm at a point where I'm trying to incorporate random number generation to determine if the NPC on the screen is friend or foe. In the global declaration area, I put:

 

dim rand16 = z

 

Inside the main loop, I put:

 

score = rand

 

When I run the game, the score ALWAYS says 74. It never changes. So I'm clearly doing something wrong. How do I make it select a random number every time the program gets to where it assigns the value? What am I missing?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...