Go Back   Gaming Gutter


» Site Navigation
» Home
» FAQ
» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Advertisement
» Recent Threads
Go to first new post How many avatars to you...
12-30-2008 10:27 AM
by Immoral
Last post by Charizard
Today 08:35 PM
20 Replies, 225 Views
Go to first new post Buying Pets with...
Today 06:51 PM
by jsndin
Last post by l_royalty_l
Today 08:35 PM
7 Replies, 26 Views
Go to first new post Favourite xbox 360 game
11-09-2008 08:09 AM
by iwowic
Last post by xdvs27x
Today 08:34 PM
69 Replies, 501 Views
Go to first new post [S] Selling Accounts...
Today 08:06 PM
Last post by iceydefeat
Today 08:34 PM
1 Replies, 12 Views
Go to first new post *~}{~* Royalty's Regal...
01-05-2009 07:30 PM
Last post by l_royalty_l
Today 08:31 PM
58 Replies, 479 Views
View Single Post

 
Old 11-25-2007, 01:39 PM   #7 (permalink)
rcadble
Underground

Male rcadble is offline
 
Join Date: Sep 2006
Posts: 248
GPoints: 602
iTrader: 2 / 100%
rcadble Is Recognizable
Rep Power: 8
Why not make it in complete function form? You should try make it a function where your user can just input the settings (as it is now, you'd have to make a new function every time you wanted to change the length).

Code:
Public Function GenerateCodeRcad(ByVal lngLength As Integer) As String
    Dim i As Integer
    Dim strRand As String
    Dim intRand As Integer
        Randomize
        For i = 0 To lngLength Step 1
            intRand = Int(Math.Rnd() * 3) + 1
            If intRand = 1 Then
                strRand = strRand & Int(Math.Rnd() * 10)
            ElseIf intRand = 2 Then
                strRand = strRand & Chr(Int(Math.Rnd() * (26) + 65))
            ElseIf intRand = 3 Then
                strRand = strRand & Chr(Int(Math.Rnd() * (26) + 97))
            End If
        Next
        GenerateCodeRcad = strRand
End Function
Unfortunately, the mid function is pretty slow for vb6, so using chr() with random ascii values would speed it up. (Mine averaged 0.93 microseconds faster, by testing them both 100,000 times).

Last edited by rcadble; 11-25-2007 at 01:50 PM..
  Reply With Quote
 
Powered by vBadvanced CMPS v3.1.0

All times are GMT -7. The time now is 08:38 PM.


vBulletin skin developed by: eXtremepixels
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The contents of this webpage are copyright © 2006-2008 GamingGutter.com. All Rights Reserved.

Page generated in 0.17042208 seconds (100.00% PHP - 0% MySQL) with 17 queries