0

Ok, im quite new to VB, im making a betting game (out of boredom) but ive got stuck at randomising a winning horse (horse betting) completely pointless i know, but im doing it to practise my skills what i learned in IT at college.

There is 7 horses to chose from in a drop down list, each with different odds (like in a real race) the player can chose the amount they bet providing they have the cash. Also all horses have names, e.g. horse 1, horse 2 etc.

Im stuck on the code to randomise a horse out of the 7 to win

then adding the winnings if they bet on that horse into their virtual account or taking out their losings if they lose.

So far, the player cannot win due to me not knowing how to randomise a winner. I know how to add and take away funds from the virtual accout

could someone help me out please, it would be appreciated

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by Drycola
0

Hi,
What i understand is "You have to choose one horse out of seven at random"

So u can use Rnd () function and Randomize function to choose One out of Seven.

0

And if I can add to what selvaganapathy said, You can use Randomize before using Rnd() so that the code will look like this:

Randomize
WinningHorse = Int(7 * Rnd + 1)

Where WinningHorse is the variable representing the number of the winning horse.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.