Hey there! Sign in to join this conversationNew here? Join for free
x Turn on thread page Beta

Visual Basic Help watch

Announcements
    • Thread Starter
    Offline

    8
    ReputationRep:
    Heyyy,
    I was wondering if anyone knows how to code a random whole number to be produced between 1 and 12.

    I've tried Int(Rnd(1, 12)) But it didn't work.

    Thanks!!
    • Community Assistant
    • Study Helper
    Offline

    20
    ReputationRep:
    Community Assistant
    Study Helper
    (Original post by CharlotteLM)
    Heyyy,
    I was wondering if anyone knows how to code a random whole number to be produced between 1 and 12.

    I've tried Int(Rnd(1, 12)) But it didn't work.

    Thanks!!
    Hey,

    Try this:
    Dim Value
    Value = Int(Rnd() * 12) + 1 )
 
 
 
Poll
Do I go to The Streets tomorrow night?
Useful resources
AtCTs

Ask the Community Team

Got a question about the site content or our moderation? Ask here.

Welcome Lounge

Welcome Lounge

We're a friendly bunch. Post here if you're new to TSR.

Groups associated with this forum:

View associated groups

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.