Delrosss Delrosss - 3 months ago 7
Vb.net Question

How do i randomly select something from a table?

Dim lolthisisatable = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}
I'm trying to select a string randomly from this table "lolthisisatable"
like (insert code that selects a string randomly from that table)
string "2" was choosen randomly

how do i do that in Visual Basic 2010

Answer

Use this code lolthisisatable(New Random().Next(0, lolthisisatable.Length-1))