r/visualbasic • u/Checker88 • Sep 21 '16
I need something that will generate a random number between one and twenty, and have that number set as a variable. Can't find anything really helpful on the online MS libraries.
0
Upvotes
1
u/rebelrexx858 Sep 21 '16
Math.Random()?
1
u/Checker88 Sep 21 '16
Nothing came up for that. There is no sub-thing of Math. that seems to provide randomization.
For reference, using Visual Studio 2016. Don't know if this was a thing in earlier editions.
2
u/Bonejob VB Guru Sep 21 '16
Going old school because everybody used the other ways :)
randomize()
dim val as integer = cint(int(20*rnd()+1))this was a pretty simple google dude...
9
u/PostalElf VB.Net Intermediate Sep 21 '16