Results 1 to 5 of 5

Thread: Random Number Generator Coding

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    3

    Random Number Generator Coding

    In my database I want to give players ratings but based 3 levels. Good, Mediocre or Poor. If I select Good then it should give ratings between 7 and 9, mediocre 5 and 7 and poor 3 and 5.

    eg

    Name Level Passing Free Kicks Tackling Shooting

    Beckham Good 9 9 7 8

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Random Number Generator Coding

    Hmmm... Yes....

    So is there a question in there somewhere?

  3. #3
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Random Number Generator Coding

    something like this perhaps:
    VB Code:
    1. Private Enum LEVEL
    2.     Poor = 3
    3.     Mediocre = 5
    4.     Good = 7
    5. End Enum
    6.  
    7. Private Sub Form_Load()
    8.     Debug.Print GenRating(Good), GenRating(Good), GenRating(Good)
    9.     Debug.Print GenRating(Mediocre), GenRating(Mediocre), GenRating(Mediocre)
    10.     Debug.Print GenRating(Poor), GenRating(Poor), GenRating(Poor)
    11. End Sub
    12.  
    13. Private Function GenRating(ByVal eLevel As LEVEL) As Long
    14.     GenRating = Int(Rnd * 3) + eLevel
    15. End Function

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Posts
    3

    Re: Random Number Generator Coding

    I have it sorted now. I described the function I wanted a reply to enable me to do. It wasn't that difficult to see. I am new to Visual Basic and was really wanting someone to use their expertise to help me, looks as if nobody is interested so I am going to do it myself and as I hit problems post them here.

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Random Number Generator Coding

    Hmmm... I'm sorry if I offended you, that wasn't my intention I just didn't understand what you wanted to do. Bushmobile however seems to have understood it and did give you a reply.

Posting Permissions

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



Click Here to Expand Forum to Full Width