Results 1 to 8 of 8

Random Number Generator 1 to 60

This is a discussion on Random Number Generator 1 to 60 within the Excel Questions forums, part of the Question Forums category; I need some help in creating a random number generator from 1 to 60 and I need to to this ...

  1. #1
    Board Regular mike31z's Avatar
    Join Date
    May 2007
    Posts
    145

    Default Random Number Generator 1 to 60

    I need some help in creating a random number generator from 1 to 60 and I need to to this for 25 different times.
    We have this wheel ( Paddle wheel and we have 20 paddles) with the numbers 1 to 60 and we sell chance tickets for a $1.00 to win 20.00.
    Then I am going to print them on business size cards that way we don't have to retrieve the actuals paddles.
    Can any one help me with a Random Number Generator for 1 to 60.

    mike in wisconsin

  2. #2
    MrExcel MVP mikerickson's Avatar
    Join Date
    Jan 2007
    Location
    Davis CA
    Posts
    17,272

    Default

    Why not just print out 60 slips of paper (numbered 1-60) and draw them from a hat?

    This formula will return a random number between 1 and 60
    =INT(1+RAND()*60)

  3. #3
    Board Regular ADAMC's Avatar
    Join Date
    Mar 2007
    Location
    UK
    Posts
    1,094

    Default

    Not sure what you mean but, if you want to generate 1 ranndom number between 1 and 60:

    =RANDBETWEEN(1,60)

    Pressing F9 will change the value.
    If this isnt what you need post back
    ADAMC (",)

    If everything seems to be going well, you have obviously overlooked something.

  4. #4
    MrExcel MVP
    Join Date
    May 2002
    Posts
    13,993

    Default

    if you don't mind repeats:

    =randbetween(1,60)

    (if you get a name! error, go to tools | addins | & activate the analysis tool pack)

    if you do mind about repeats, a few options here:

    http://www.tushar-mehta.com/excel/ne...ion/index.html

  5. #5
    Board Regular mike31z's Avatar
    Join Date
    May 2007
    Posts
    145

    Default Random Number Generator

    I need to generate a set of random numbers 1 to 60 in groups of 3 non repeating groups, That will give me 20 sets of three numbers.

    Then I would like to create 20 to 25 sets of these numbers. with each group being different. We use it as one of our fund raiser for different events in our community.

    mike in wisconsin

  6. #6
    Board Regular mike31z's Avatar
    Join Date
    May 2007
    Posts
    145

    Default Random Number Generator 1 to 60

    Paddyd, I looked at your link and I don't know enough if what I want is there but


    thank you



    I did find this


    http://www.randomizer.org/form.htm



    That provide the numbers now I have to get it to bussiness cards.

    mike in wisconsin

  7. #7

    Join Date
    Jan 2003
    Posts
    810

    Default

    Or you can try
    Code:
    Sub noreprand()
    n = 60
    ReDim a(1 To n, 1 To 1), c(1 To n, 1 To 3)
    For t = 1 To 3
    p = 0
    For i = 1 To n
        a(i, 1) = i
    Next i
    Do
        x = Int(Rnd() * n) + 1
        If Not IsEmpty(a(x, 1)) Then
            p = p + 1
            Cells(p, 40) = p
            c(p, t) = a(x, 1)
            a(x, 1) = Empty
        End If
    Loop Until p = n
    Next t
    [a1].Resize(n, 3) = c
    End Sub

  8. #8
    MrExcel MVP
    Join Date
    Aug 2004
    Location
    Tokyo, Japan
    Posts
    16,995

    Default Re: Random Number Generator 1 to 60

    I need some help in creating a random number generator from 1 to 60 and I need to to this for 25 different times.
    We have this wheel ( Paddle wheel and we have 20 paddles) with the numbers 1 to 60 and we sell chance tickets for a $1.00 to win 20.00.
    Then I am going to print them on business size cards that way we don't have to retrieve the actuals paddles.
    Can any one help me with a Random Number Generator for 1 to 60.

    mike in wisconsin
    try
    Code:
    Sub test()
    Dim myMaxNum As Long, mySet As Long, a(), i As Long, ii As Long, iii As Long
    myMaxNum = Int(Application.InputBox("Enter limit",type:=1))
    If myMaxNum < 1 Then Exit Sub
    mySet = Int(Application.InputBox("How many sets?", type:=2)
    If mySet < 1 Then Exit Sub
    ReDim a(1 To myMaxNum, 1 To 2)
    Randomize
    For i = 1 To mySet
         For ii = 1 To myMax
              a(ii,1) = i
              a(ii,2) = Rnd()
         Next
         VSortMA a, 1, UBound(a,1), 2
         .Range("a1").Offset(,iii).Resize(UBound(a,1)).Value = a
         iii = iii + 1
    Next
    End Sub
    
    Private Sub VSortMA(ary, LB, UB, ref)
    Dim i As Long, ii As Long, iii As Long, M As Variant, temp As Variant
    i = UB : ii = LB
    M = ary(Int((LB+UB)/2,ref)
    Do While ii <= i
         Do While ary(ii,ref) < M
              ii = ii + 1
         Loop
         Do While ary(i,ref) > M
              i = i - 1
         Loop
         If ii <= i Then
              For iii = LBound(a,2) To UBound(a,2)
                   temp = ary(ii,iii) : ary(ii,iii) = ary(i,iii) : ary(i,iii) = temp
              Next
              i = i - 1 : ii = ii + 1
         End If
    Loop
    If LB < i Then VSortMA ary, LB, i, ref
    If ii < UB Then VSortMA ary, ii, UB, ref
    End Sub

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com