Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random Number Generator
#5
Well, here's a quick code snippet that I crafted especially for you!

Since an integer can't hold something that is 15 characters long, we need to individually generate 15 random integers and insert them into a String. Like so,
[code2=vbnet]Dim randomNumberLength As Integer = 15
Dim randomNumberString As String = ""
For i As Integer = 1 To randomNumberLength Step 1
Randomize() 'Randomize the numberset
randomNumberString += CInt((Rnd() * 10)).ToString 'Generate a number from 0-9 and tack it onto String.
Next[/code2]

Hopefully this helps solve your problem. If you have any questions about this code, feel free to ask!

The variable randomNumberString is now your random number of randomNumberLength characters long.
My Blog | My Setup | My Videos | Have a wonderful day.


Messages In This Thread
Random Number Generator - by manishshrestha60 - 10-28-2012, 06:26 PM
Re: Random Number Generator - by Cartman - 10-29-2012, 03:20 AM
Re: Random Number Generator - by manishshrestha60 - 10-29-2012, 05:10 AM
Re: Random Number Generator - by Cartman - 10-29-2012, 05:50 AM
Re: Random Number Generator - by brandonio21_phpbb3_import2 - 10-30-2012, 05:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to play random .wav files with a button click STrooper501 0 7,205 04-17-2013, 03:32 PM
Last Post: STrooper501
  auto generated number jochen29 3 13,514 10-01-2012, 02:52 PM
Last Post: brandonio21

Forum Jump:


Users browsing this thread: 1 Guest(s)