Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Generate Random Numbers Without Repeating


I need to generate random numbers, from 1 to 15. The program runs a timer, and every second, a new number is generated, but it cannot be one that was already generated. This means that by time the 15th number is reached, it will be automatically chosen.

I have created a way of doing this involving 15 extra variables that are filled when each number is used. It works, but it seems to bog down the timer, since it is checking so many variables. Is there a simpler way of doing this?

Thanks,
Jason




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Generate Random Names Without Repeating That Name Again!!!!
What code is needed to stop generating the same name over and over again, becasue i want it to randomly generate the name once and then choose another. YOUR HELP WILL BE A PRECIATED

Random Numbers Repeating...
For a school project i have to get random numbers for 1 to 75 and display 25 of the random numbers, but without any repeating....so i need to know how you make it so the no number repeats itself when displayed...

if you need more info, i'll be happy to supply it

Repeating Random Numbers
I want to create a function that creates 4 random numbers. but I want it so if i use the same value in the seed i always get the same numbers. This is the code that i thought would work...


Code:
Sub testRandoms(seed As Long)
Randomize seed

For i = 0 To 3
Debug.Print Rnd(1)
Next i
End Sub


calling "testRandoms 2000" i get

0.8549716
0.2907182
0.1909369
0.3054054

calling "testRandoms 2000" again, i get
0.8630618
0.4922775
0.1587687
0.9343805

they're not the same!!!!
what am i doing wrong?

28 Non Repeating Random Numbers And Freezing
I need to make a matching game for a project. I have the game itself all made and it works good. Now I need to make the placement of the cards random. I have 28 "cards" therefore 28 random non repeating numbers. 1-28. I have them on a timer all making seperate random numbers, and if the number made is equal to any numbers made before it, it will goto the begining of it's own seperate number randomizing code. But when I try to play it, just to see if it doesn't freeze, it does. Any help on a way to obtain my goal would be much appreciated.

PS, i need to be able to return back to the numbers, (like if num1 = 1 then image1.top = a number...and so on, so listing them in an array wouldnt work, least i dont know how to make it work like that.)

Thanx

How Do I Create Random But NO Repeating Numbers??
Hi,

I am using an array of 6 Text Boxes and In thoughs boxes I need 6 Numbers to appear.

The Numbers are from 1-49.

How do I get these numbers to be Random and make sure they are NOT repeated In any of the OTHER Boxes??

Thanks to ANYONE who can help Me on this.

Bye

Generating Random Numbers, But Not Repeating Any, Is There An Easy Way To Do This?
How can I generate random numbers but not repeat any that have already been generated. Is there an easy way to do this at all?
Thanks!
Eric

Random Numbers-is It Possible To Generate Random Numbers With A Algorithum?
The rnd function in vb generated pseudo-random numbers. That means if you use these numbers as a key for some type of encryption it would make it fairly easy to break(if you knwo how) because you can predict what numbers will be generated by the rnd function.

I'm trying to design a method that might involve a couple of diffrent algorithums to genertae random numbers.
One of my idea's was to monitor network traffic for numbers, error messages, etc...
If anybody has idea's, code, or comments please reply!
At the moment I have absolutely know idea howto monitor the arrival of packets or error messages, so if you knwo how please respond!!!

Generate Random Numbers With VBA
hello to all,

I've a little problem. Actually, I want to performe action resulting from conditions like IF...ELSE ...

But there is a probability of realisation of each condition.

Example: In 10% of the case, you win 1 million $, in 20% 500.000$ and in 70% you loose.

How can I do that inn VBA ?

Thanks

thomas

How Do I Generate Random Numbers?
I am making a new program and I need to know how to make it generate a random number from 1 to 100. I found one way on the web, but the numbers always seem to go in this order: 71,54,58, and so on. The order is always exactly the same. I need to find a way to make the numbers purely and truely random, and not just in a certain order. I know in pascal, the language I used to use, it is pretty easy to do. I just dont know how to do it in vb.

Generate 6 Random Numbers
hey..how do i generate 6 random numbers? these numbers have to be in a serial form like those used on receipts..for example 000001, 000002 and so on..plz help!

A Way To Generate 3 Random Numbers
I'm just getting in to VB and I hope someone can point me in the right direction.

I am trying to create a form for contact information for field techs. I need to put something on the form, (i.e. command button, on_click, or even on_enter) that will generate a random 3 digit number between 001 and 999 in a text box. The purpose is to assign beeper codes to each tech, so the number generated has to be assigned to that tech's contact information.

thanks

Need To Generate Random Numbers
Hello all,

I need to generate random numbers from 1 to 16. I have 16 buttons on the form and I want to give each of those a different number at startup. In other words every button will have a different number ranging between 1 to 16.

Can someone help me with the code.

Thanks in advance

How To Generate 6 Digit Random Numbers?
Hello everybody,

How can I generate a 6 digit random numbers which is 0-9? Can anybody help me on this?

lexthor

Generate Random Numbers And Letters
How can i generate random number and letters
like
67y463623jb3bjhbfabv7vgsdv97g9v7zvbhj v<zjucas?

i have this command :
Dim character As String
character = character & Format(Rnd * 100, 0)

print character

but it only generates random numbers... i want to also generate random letters... how can i do this?

Generate Random Numbers And Write Them To A File
Hi there!
I have got the following problem:

I would like to generate a really big number (even up to 1 GB length) and write it to a file in binary mode. I am using two loops at the moment. The first one generates a random number and appends it to a string which is 64 KB long. Then I write the string to the file and generate new numbers, append them to a string, append the string to the file... The problem is that this will take such a long time to complete. I don't know how this wipe programs handle such huge files in such a short time. I was able to delete a 1 GB file in ~10 minutes and with my method it take over 2 hours (canceled the operation after 2 hours - was too much for my PII ). Actually, I would like to do such a file wiper my own, but as I said, not sure how. It works fast if I use fixed strings like Chr(0) or Chr(255) and fill the whole file with them, but that isn't really secure. DoD uses a random number generator and as I said, my loop method is really lame.

Any ideas? Thanks!

Taking To Long To Generate Random Numbers/letters
Hey all I have this code I thought up. At first it ran pretty quick but since then the database has filled up with about 65+ database entrees. Problem being is that it really is slow now once the user saves the data.

Is there any way I can edit this code to get it to do a random number faster? I had a problem with it making the same number over and over again for each save the user did - which was not good since it needs to all be different and I made this code and it works fine now but like I said, just gets slower and slower as more data is saved.

Code:
Private Sub cmdSave_Click()
Dim rst As ADODB.Recordset
Coupons.MousePointer = 11
Open_Database
Set rst = New ADODB.Recordset
rst.Open "CoupLayout", conn, adOpenDynamic, adLockOptimistic
If cmdSave.Tag <> "GetBC" Then
Call Bcodeness
Else
End If
Do Until rst.EOF
If rst!Bcode = Bcode Then
cmdSave.Tag = "GetBC"
Coupons.MousePointer = 0
rst.Close
Set rst = Nothing
Call Bcodeness
Exit Sub
Else
rst.MoveNext
End If
Loop
cmdSave.Tag = ""
rst.Close
Set rst = Nothing
End Sub

Public Sub Bcodeness()
Dim n1, n2 As Integer
Dim L1, L2 As String

n1 = Int(Rnd * 12)
n2 = Int(Rnd * 22)
L1 = Int(Rnd * 26) + 65
L1 = Chr$(L1)
L2 = Int(Rnd * 26) + 65
L2 = Chr$(L2)
Bcode = n1 & L2 & L1 & n2 & "E"

If cmdSave.Tag = "GetBC" Then
cmdSave_Click
Else
End If
End Sub
Any help would be great!

David

Non-repeating Random No&#039;s
Apart from being a complete beginner with VB, I would like to know how to generate a group of 6 random numbers (displayed in 6 labels) with none of those numbers being the same.

I am already aware of the Int(RND * 49)+1 code line that creates a random number between 1 and 49. How can i get non-repeating numbers in my question above?

Repeating Numbers
how do I get visual basic to ignore the fact that "1/6" is a repeating number... basically, I want to multiply "1/6" six times to equal 6, but it keeps giving me "1.0000000000000000" blah blah blah. How can i have it make a clean "1"?

thanks!

Repeating Numbers
Do anyone have any code that could tell if a series of nine numbers are repeating? I am checking to see if a SSN is all repeating numbers. For example, a person's SSN is 999999999.

Thanks
Shannon

Non-repeating Psuedo Random Number Generators
I use this from time to time and just thought I'd share it...

Code:
'=========================================================================================
' Random Number Functions
' by Mark R Hamner (maxhamner (at) hotmail.com)
'=========================================================================================

Private rnd_PR8 As Byte
Private rnd_PR16 As Long


'=========================================================================================
' PSEUDO RANDOM NON REPEATING
' These routines generate a fixed pattern, BUT, they generate every value in a range
' ONE time before it repeats. This effect is very useful for pixel fades because if
' you use the value to determine a pixel to draw (or erase) it will generate all the
' values only 1 time, meaning all pixels will be addressed without testing or maintaining
' an array. Applications are limited, but VERY useful in specific cases.
'
' Call routine once passing a seed value, then
' Call it without a value to get successive pseudo random values
'
' NOTE: The value 0 will not be generated, but can be used as a seed.
'
' This method was originally in a Dr Dobbs journal in the mid 80's, along with a table
' of mask values that would generate various ranges. I have used this routine 100s of
' times in assembly for various graphics effects (like pixel fades for older palm pilots)
' and converted it to VB to use for a 'block' fade effct (bitblt blocks, not pixels)
' and thought someone might find a good use for it.
'
' If anyone has a copy of the original article please email it to maxhamner (AT) hotmail.com
'=========================================================================================


' This generates a pseudo random 8 bit (1-256) value
Public Function rnd_pseudo8(Optional myval As Byte)
    If IsNumeric(myval) And (myval <> 0) Then rnd_PR8 = myval
    carry = ShiftRight(rnd_PR8)
    If carry Then rnd_PR8 = rnd_PR8 Xor 184 '0b8h
    rnd_pseudo8 = rnd_PR8
End Function

Public Function rnd_pseudo16(Optional myval As Integer)
    If IsNumeric(myval) And (myval <> 0) Then rnd_PR16 = myval
    carry = ShiftRight(rnd_PR16)
    If carry Then rnd_PR16 = rnd_PR16 Xor Int(46080) '0b400h
    rnd_pseudo16 = rnd_PR16
End Function

'------------------------------------------------------------------------------
Private Function ShiftRight(ByRef myval) As Boolean
    Dim result As Variant
    result = myval / 2
    myval = Int(result)
    If Int(result) <> result Then ShiftRight = True Else ShiftRight = False
End Function


-max
maxhamner aht hotmail daught com

APIs are not an ADD-ON to VB, they are its FOUNDATION.

I Can't Stop Repeating, Repeating,repeating,repeating,repea . . .
I have a function which adds together three integers from an array in a loop. It tests for TRUE and puts the result in another array. Thus: A+B+C=X.
I would like to filter same results, for example if we want X=10 then 5+2+3=10 or 5+1+4=10 but there is no need to repeat 2+3+5=10.

Here's what I got so far:

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function Combine(Values, TargetValue) As String()

Dim arr1, arr2, arr3
arr1 = rArray
arr2 = rArray
arr3 = rArray
Dim i As Integer, j As Integer, k As Integer
Dim arr() As String
For i = 0 To UBound(arr1)
For j = 0 To UBound(arr2)
For k = 0 To UBound(arr3)
If arr1(i) + arr2(j) + arr3(k) = intVal Then
arr = AddToArray(arr, arr1(i) & " + " & arr2(j) & " + " & arr3(k) & " = " & intVal)
End If
Next k
Next j
Next i
Combine = arr

End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Then to read the contents:

Private Sub cmdRes3_Click()

On Error Resume Next
intVal = txtVal.Text
Dim arr() As String
Dim i As Integer
arr = Combine(rArray, 10)
txtAns = "" 'clear textbox
For i = 0 To UBound(arr) - 1
'Debug.Print arr(i)
txtAns = txtAns & arr(i) & vbCrLf
Next 'multi dimensional

NoGood_click ' combination error

End Sub

Obviously I left out a lot of code but I had wanted to show the general idea.

The Random Function Gets The Same Random Numbers Every Time I Start The Program
I'm making a Poker program

The code is like:
Command1_click sub()
Card1.caption = int(rnd()*53) +1
Card2.caption = int(rnd()*53) +1
Card3.caption = int(rnd()*53) +1
Card4.caption = int(rnd()*53) +1
Card5.caption = int(rnd()*53) +1
End sub
( I use much more codes of course)

When I click the command1 button, I get the numbers random, but I get the same random numbers in the same order every time I start the game.
Example.

I start the game:
I click command1: card1= 9, card2= 18, card3= 42, card4= 23, card5= 4
I click command1 again: card1= 7, card2= 51, card3= 13, card4= 29, card5= 14
and so on, random every time I click...

I start the game again, another time:
I click command1: card1= 9, card2= 18, card3= 42, card4= 23, card5= 4
I click command1 again: card1= 7, card2= 51, card3= 13, card4= 29, card5= 14
and so on, random every time I click. But I get the same numbers, In the same order.

I hope I've explained my problem well.
Please, help.... =(

Random Generate
Hi,

I'm tryin to write a little program that generates names i have got 2 .txt files the 1st contains first names 2nd contains surnames, i want the program 2 take random first names and merge them with random surnames and export the results into another txt file, is this possible can any1 help me out ?

Thanks in Advance
Slash

Generate Random ID In ADO
hi guys.
im creating a random number for an id in ADO.
i tried it in DAO and it worked well. but my project now isa ADO.

how can i convert this code to ADO?

thanks in advance!




[highlight=VB]
------------------------------------------------------

Quote:




Function GenerateNum() As String
Set rsCustomer = dbSSS.OpenRecordset("Customer")
Dim strNum As String
Dim vlRndNum As Long

Randomize
Do
vlRndNum = Int(Rnd * (999 - 1111 + 1)) + 1111
strNum = Format(Date, "YY") + "-" + Trim$(Str(vlRndNum))

rsCustomer.Index = "CustomerID"
rsCustomer.Seek "=", strNum

Loop Until rsCustomer.NoMatch
GenerateNumComp = strNum
txtNewCustomer.Text = GenerateNumComp

End Function





--------------------

is this possible? in ADO?
thanks guys!


-

Generate Random CD Key
Anyone know how to generate a random key using all capital letters and numbers? Something like this:

D4X4BW-H9RO4M-PP3NSE

It can be in one text box or 3, it doesn't matter

Generate Numbers
hallo all. my problem is ....
i created one application for generating random numbers and using a one module for generating from vb page with code.. so..
i created a textbox named txtbox3 and txtbox1 for input user defined number for start and stop generating numbers.
everytime a program generating numbers starts from " 1 " to user defined number.
where is a problem but no start generating from textbox input number.
i gave a sample code of program.

interface having a
one listbox named text2
two textboxes named text1 and text3
one button named Command1

code of Form1.vb

Dim sequence() As Integer

Private Sub Command1_Click()
Text2 = ""
If Not (IsNumeric(text3.Text)) Then
MsgBox ("Pleace Enter a number")
Exit Sub
End If
If Val(text3) = 0 Then Exit Sub
ReDim sequence(Val(text3.Text))
If (getnewsequence(sequence, Val(text3.Text))) Then
'Debug.Print " sequence generated OK"
Else
'Debug.Print " sequence NOT generated "
End If
Dim Text1 As Integer
For Text1 = Text1 To Val(text3.Text)
Text2.AddItem (Text2 & sequence(Text1))
Next
End Sub

Private Sub Form_Load()
Text1 = Text1.Text
End Sub


code of module ... module named a " modrndnumgen "

Dim uniqueseq() As Integer
Dim numberofnumbers As Integer
Public Function getnewsequence(sequence() As Integer, number As Integer) As Boolean
On Error GoTo error
ReDim sequence(number)
Dim Text1, newnum As Integer
numberofnumbers = number
ReDim shufseq(numberofnumbers + 1)
ReDim uniqueseq(numberofnumbers + 1)
newnum = Randomgen
uniqueseq(1) = newnum
sequence(1) = newnum
For Text1 = 2 To numberofnumbers
Do
newnum = Randomgen
Loop Until ((checkifexists(newnum)) = True)
uniqueseq(Text1) = newnum
sequence(Text1) = newnum
Next
getnewsequence = True
Exit Function
error:
getnewsequence = False
End Function

Private Function Randomgen() As Integer
On Error Resume Next
Randomize
Do
Randomgen = Int((numberofnumbers + 1) * Rnd)
Loop Until Randomgen <> 0
End Function
Private Function checkifexists(number As Integer) As Boolean
On Error Resume Next
Dim Text1 As Integer
For Text1 = 1 To numberofnumbers + 1
If number = uniqueseq(Text1) Then
checkifexists = False
Exit Function
End If
Next Text1
checkifexists = True
End Function


i dont no where is a problem may be a
numberofnumbers = 0
to starts from 0 generate
i try to change it and gives me errors

How To Generate Numbers
Hello VB Experts! Do any of you know how to generate random numbers in Visual Basic 6 Professional?


Thanks

Generate Numbers
I created a generated number application that stores in an array with indexes 1 to 100 numbers. Generate the number to be stored at each index by summing the index and its individual digits. Example, 25 should be stored at index 17 cause 17 + 1 + 7 = 25 and 4 should be stored at index 2 cause 2 + 0 + 2 = 4. Heres the code I got so far.


Code:

Option Explicit

Private Sub cmdDone_Click()
Unload Me
End Sub

Private Sub Form_Load()

Call FillArray
Call DisplayArray

End Sub

Sub FillArray()
Dim intNumbers As Integer
Dim intGenerate As Integer
intGenerate = intNumbers + 1
For intNumbers = 1 To 100
lstOutcome.AddItem intNumbers & vbTab & intGenerate
Next
End Sub

Sub DisplayArray()
Dim intNumbers As Integer
lstMessage.AddItem "Index" & vbTab & "Generated Number"
For intNumbers = 1 To 100
lstOutcome.AddItem intNumbers
Next
End Sub

Generate A Random String
' the mask must contain the following special chars
' ? : any ASCII character (1-127)
' # : a digit
' A : an alphabetic char
' N : an alphanumeric char
' H : an hex char
' all other chars are taken literally

' Example: a random-generated phone number
' phone = RandomString("(###)-####-####")

Can someone please give me the right code to do this.
I want to use it in a normal textbox.

many thanks to the one who give me the right solution for my problem

greetzzz

How Do You Generate A Random Number...
...between 60 & 120?

dim i as long
i = Rnd * 10


yeah, I'm stuck.

Random Num - Dont Generate Same Num
Hi all,

I'm experimenting with a small VB game and generating a random number with the function:

Public Function Rand(ByVal Low As Long, ByVal High As Long) As Long
Randomize 'initialize the seed
Rand = Int(High * Rnd + Low)
End Function

And doing the following: boxElement = Rand(0,21)

However, I do not want to generate the same number twice. Can someone please point me in the right direction as to how to do this?

Thanks, Percy

Can You Generate Random Words
Can you generate random words, and if so how

How Do I Generate A Random Number
i would like to generate a random number when a cmd is selected
but i want it so it only picks a number say between 1-20

how would i do that?

Hello All How Do I Generate Random Operators..
The application is a math tutor... with 2 numbers just generating randomly numbers between 1-10 and then there's a label box in between these two numbers which will be the operators... e.g +, - , / , *
So when i run the application it'll show
for example..

1 X 4 =
2 - 5 =
1 + 9 =
3 / 9 =
etc...
the hint tells me to... (hint: generate random numbers to represent the operators). This is what I got so far but it seems to still not generate random operators please help.



Option Explicit
Private intOne As Integer
Private intTwo As Integer
Private intOperator As Integer

Private Sub cmdDone_Click()
Unload Me
End Sub

Private Sub Form_Load()
Randomize
intOne = Int(10 * Rnd + 1)
intTwo = Int(10 * Rnd + 1)
intOperator = Int(4 * Rnd + 1)
If intOperator = "4" Then
lblOperator.Caption = "+"
ElseIf intOperator = "3" Then
lblOperator.Caption = "-"
ElseIf intOperator = "2" Then
lblOperator.Caption = "*"
ElseIf intOperator = "1" Then
lblOperator.Caption = "/"
End If
lblOne.Caption = intOne
lblTwo.Caption = intTwo
lblOperator.Caption = intOperator

End Sub

Generate Random # Within Given Range
Good Morning,

I am currently using VB6 with SP6 and I am trying to generate a random number between a user defined range. I know this is possible but cannot recall how it is done. Could anyone please help? Here is the code that I am trying.


Code:
Randomize
p = Timer

Label3.Caption = Str(p)
Result = CLng((Int(Hi * Rnd(p))) + Lo)



All variables are defined as long. The p variable is just used so that I can see the RND seed that will be used just to make sure that it is getting some number other than 0. The Hi and Lo variables are the variables used to contain the user defined range for the random # to be generated.

For example if Lo=50 and Hi=75 then the random number generated would be greater than or equal to 50 AND less than or equal to 75. But when I run the program I get numbers that are greater than 75.

Thank you all for your time and effort in this problem.

Have a great day
God Bless

Generate A Random Password
Hi,

What would be the easiest way to make a VB app generate a random password that contained numbers and letters (upper and lower case) of say 10 characters in length?

Cheers

Simon

How To Generate A Random Number??
Lets say I want a number between 1 & 10.
I tried this code, but it's not working...


VB Code:
Private Sub cmdGenerate_Click(Level As Byte)   MsgBox i((10 - 1 + 1) * Rnd + 1)End Sub

Generate Random Filename
hi friends, how to generate random filenames. i mean some random text that i can use as filenames. or some function that will return random character such as rnd generates random number

thanx

Generate A Random Integer
Hello I am trying to remember how to set it to generate a random integer in a variable. the best way to explain what I am trying to learn is Say you want to when you click on a command button you want it to set strVal to a number between 1 and 6 (sorta like rollin a dice) for a game a chance type thing.

I thought it would be


VB Code:
strVal =Rnd(1 - 6)


but could not get it to work.

Generate Random Number?
Hi,

How would I generate a random 4 digit number, without ever encountering the same of a single digit? For example, I wouldn't ever want to generate 0000 or 1111 or 2222... I think you get the point.

Thanks,

Dan

How Do I Generate A Random Number
Hi, I'm trying to generate a number. I need the number to be divisible by 100 eg. 100,200,300 etc. I have no idea how to generate any kind of number in vb. Thanks

How Can I Generate Random Pictures?
i am currently working a game. i draw out imageboxes named "imgControl" (using index property) in a form.
my problem is how can i generate random picked pictures that are stored in a folder and display them in the imgControl during run-time? (by the way the random pictures must be picked up twice) e.g: picA picA, picD, picD.

How Does VB Generate A Random Number?
How does VB generate a random number... ive been thinking and i cant see how a machine can get a truely random number... any ideas?

How Do I Generate A Random Password
I am working on VB type form that will simply have a label and a Command button.

All I want the button to do is run a code that will generate a random password that is 7 characters in length with 1 or 2 numbers and the rest being lowercase letters. I want the code to write to the label. I don't want to store or send the password to anyone.... just generate it so I can use it later if need be. This form will be inside an Access database we use for tracking these passwords.

This is the code I have right now, but as I am new to vb coding, I am not sure how to make it work....

Code:

' /* In A Code Module Add This: */

Public Function Gen_Rand_Password(PassLength As Integer) As String
' /* Dimension A Variable To Contain The Random Password */
Dim RetVal As String

' /* Dimension Variables To Contain The Upper and Lower Random Boundaries */
Dim Max As Integer
Dim Min As Integer

' /* Set The Limits Of Min and Max To Character Codes Relevant To The Keyboard */
Max = 126
Min = 48

' /* Set The Random Number Generator, Using Timer as the Seed */
' /* This Makes The Psuedo-Random Number A Little More Random */
Randomize Timer

' /* You Can Change This To The Desired Length, 8 is Pretty Much A */
' /* Standard Password Length */
If PassLength < 8 Then
' /* Return From Function With An Error */
Gen_Rand_Password = "error: invalid length"
End If

' /* Loop Until We Reach The Desired Length Of The Password */
For I = 1 To PassLength
' /* Concantenate (append) RetVal with Random Keyboard Character */
RetVal = RetVal & Chr(Int((Max - Min + 1) * Rnd + Min))
Next I

' /* Return That Value To The Calling Procedure */
Gen_Rand_Password = RetVal
End Function


' /* In Your Form (or In Another Procedure) [Call It Like This] */
' /* The Value Passed To The Function (8, In This Case) */
' /* Is The Number Characters That Will Be Returned */
RandomPassword = Gen_Rand_Password(8)



Can someone please give me an idea of what I am doing

Generate Random Four Fix Digits
Hi pros,

How can i do a random number to generate with fix four digits from 0 to 9999.

I use:

Dim MyValue As String
MyValue = Int((9999 * Rnd)) ' Generate random value between 0 and 9999.
lblnumbers.Caption = MyValue

It does generate numbers but at times 1,2 or 3 digits.I would like a fix four digits.

Thank you very much.

Yahoo! Biztools
- Promote your business from just $5 a month!

How To Generate Random Values In VB(help!)
hello All!

I am asked to fill up a table with values not manually but programmatically.
There are 4 fields in the said table and one of the fields are supposed to contain random values.

Q: How are random values generated in VB?

and one set of these random values are supposed to follow a 35-digit length,meaning, if the generated value is less than 35, I have to prefix it with xxx to attain the 35 digit length.

I hope somebody can help. I am new to this so pardon me for my query.

How To Generate Random Number
How i can generate random number using VB6.

Please help.Thanks

How To Generate A Random Number
Hi, everyone,
How to generate a random number from a given list? Thank you

How Can I Generate Random Pictures?
i am currently working a game. i draw out imageboxes named "imgControl" (using index property) in a form.
my problem is how can i generate random picked pictures that are stored in a folder and display them in the imgControl? (by the way the random pictures must be picked up twice) e.g: picA picA, picD, picD.

Copyright 2005-08 www.BigResource.com, All rights reserved