Ask Experts Questions for FREE Help !
Ask

Generating random numbers

Asked Oct 26, 2008, 09:29 PM — 11 Answers
Not gernating same number twice in a row

11 Answers
aaj2008's Avatar
aaj2008 Posts: 139, Reputation: 54
Junior Member
 
#2

Oct 26, 2008, 09:32 PM
There is actually a list of numbers on what is called "the table of random digits" I had to use it in Statistics...and its a table of random digits basically that were computer generated...kind of neat actually
Helpful
bindizzle's Avatar
bindizzle Posts: 7, Reputation: 1
New Member
 
#3

Oct 26, 2008, 09:35 PM
Hey aaj2008
Helpful
bindizzle's Avatar
bindizzle Posts: 7, Reputation: 1
New Member
 
#4

Oct 26, 2008, 09:36 PM
Here is my problem
To create a program that generates 7 random numbers display it in 7 labels and there a button if you click it picks out the highest number
Helpful
aaj2008's Avatar
aaj2008 Posts: 139, Reputation: 54
Junior Member
 
#5

Oct 26, 2008, 09:38 PM
Are you trying to create a computer program? Or are you just using one? Or are you trying to create this on like a TI calculator?
Helpful
aaj2008's Avatar
aaj2008 Posts: 139, Reputation: 54
Junior Member
 
#6

Oct 26, 2008, 09:39 PM
On a TI calculator there is an application to pick random digits and you can enter how many digits you want and tell it to give you the highest one first...
Helpful
bindizzle's Avatar
bindizzle Posts: 7, Reputation: 1
New Member
 
#7

Oct 26, 2008, 09:46 PM
I'm trying to create it on Vb 6.0. The random number should be stored in a variable. Here is what I got so far.

Option Explicit
Dim random(0 To 6) As Integer
Dim old(0 To 6) As Integer
Dim Index As Integer
Dim I As Integer




Sub generate()

For I = 0 To 6
Random(i) = Int(Rnd * 25 + 1)
If random(i) = old(0 Or 1 Or 2 Or 3 Or 4 Or 5 Or 6) Then
Random(i) = Int(Rnd * 25 + 1)
End If

Old(i) = random(i)
Lblnum(i).Caption = random(i)
Next i



End Sub
Private Sub btnrandom_Click()
Generate
End Sub
Helpful
bindizzle's Avatar
bindizzle Posts: 7, Reputation: 1
New Member
 
#8

Oct 26, 2008, 09:47 PM
This doesn't work. I think I need to create a loop where it loops till it finds a random number that has not been generated before
Helpful
aaj2008's Avatar
aaj2008 Posts: 139, Reputation: 54
Junior Member
 
#9

Oct 26, 2008, 09:49 PM
I don't really know actually...it looks like it should work to me...umm..I'm getting tired and about to head to bed but I will do a little research and ask one of my professors in the morning...but yeah the loop might help but not sure
Helpful
bindizzle's Avatar
bindizzle Posts: 7, Reputation: 1
New Member
 
#10

Oct 26, 2008, 09:52 PM
Thanks for your effort. Appreciate it
Helpful

Not your question? Ask your question View similar questions

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Add your answer here.

Remove Text Formatting

Undo
Redo
 
Decrease Size
Increase Size
Bold
Italic
Underline
Align Left
Align Center
Align Right
Ordered List
Unordered List
Decrease Indent
Increase Indent
Insert Email Link
Wrap [QUOTE] tags around selected text
Wrap [CODE] tags around selected text
Wrap [HTML] tags around selected text
Wrap [PHP] tags around selected text
Wrap [YOUTUBE] tags around selected text
Notification Type:



Check out some similar questions!

Generating inheritance [ 3 Answers ]

My husband is retiring from work when he turns 65 next month. He has a life insurance policy from his employer for 80,000 which he is eligible to convert but it will cost 314 dollars a month in premiums. He has had cancer, is also on Lipitor and is bipolar so applying for a new policy will involve...

Auto Generating Sequential Numbers in Excel 2003 [ 2 Answers ]

Hello All I would like to have sequential Auto Generated Numbers in column A of my Excel 2003 Spreadsheets e.g A1=1, A2=2, A3=3 etc. But I would like Excel to auto generate this number, rather than input?

How do you wrie a program using that attatches the random numbers together [ 1 Answers ]

#include #include #include Using namespace std; Int main() { int i; srand( (int) time(NULL)); i = rand()%4; int num =


View more Visual Basic questions Search