Jump to content

Random Numbers!

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
PascalPro

PascalPro

    Newbie

  • Members
  • PipPip
  • 13 posts
I'm wondering how I could tell VB to pick a random number 1-12. I'm making a multiplication game where VB picks 2 numbers between 1 and 12 and tells the user if he/she is correct. I need help on the random numbers part

#2
RagedSparrow

RagedSparrow

    Newbie

  • Members
  • PipPip
  • 10 posts
So basically what you are wanting the program to do is pick a random number and assign that number between 1 and 12 and assign it to a variable, then have the program tell the user if it matches the user's input?

Dim random as New Random
dim num as integer
num=random.next(1,13)

That is the code just for generating the random number between 1 and 12. If you need help with any other part of the code just ask.

#3
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Please read the rules how to ask for help:
http://forum.codecal...p-properly.html

Please edit your post accordingly and another time stick to the rules.

#4
CDubb

CDubb

    Newbie

  • Members
  • Pip
  • 5 posts
How do u keep the random number the same until it is guessed correctly

#5
o0TheNerd0o

o0TheNerd0o

    Learning Programmer

  • Members
  • PipPipPip
  • 61 posts
Make it a global variable (dim random outside the random function).
Option Explicit
:cool: