Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
C

CowlitzTroy

@CowlitzTroy
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Finding Duplicate numbers
    C CowlitzTroy

    My class is now over. I had an issue with the the assignment. I couldn't get the program to find and display the duplicate random numbers. I've looked for almost two weeks for an answer and I'm hoping that someone here can help me. This was the assignment: Present the following report – (you will modify this based on user input and the actual rolls. Number of dice:2 Number of sides:6 Number of rolls:2 Dice 1 Roll 1 = 5 Dice 2 Roll 1 = 6 Dice 1 Roll 2 = 1 Dice 2 Roll 2 = 1 Number of rolls where all dice were the same: 1 I got everything but the number of rolls where all the dice were the same. Can someone please advise me as to how this should have been done? Here is a snippet of what I did:

    'Start the randomization process
    Dim RandomClass As New Random() 'Our random number generator

    Dim vRoll() As Integer 'User entered variable for the array
    ReDim vRoll(nDice) 'dynamic number entered by the user

    Dim cntDice As Integer = 0

    Dim myArray As New List(Of Integer)
    Dim temp As Integer

    myArray.Clear()

    'Get the number of rolls and the number of dice and then randomize the rolls.
    For i As Integer = 1 To rRoll
    For j As Integer = 1 To nDice
    temp = RandomClass.Next(1, dSize + 1)
    LST_Items.Items.Add("Dice " & j & " Roll " & i & " = " & temp.ToString)
    If Not myArray.Contains(temp) Then
    cntDice += 1
    LBL_Same.Text = cntDice
    Else
    LBL_Same.Text = "0"
    End If
    Next
    Next

    So if anyone is willing to give me advice I would greatly appreciate it. Thanks!

    Troy E Bouchard

    Visual Basic help data-structures question lounge
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups