java - How to Initialize a random number generator within an array to use for a bubble sort -
so coding class, asked create bubble sort method take array generate random numbers array, , sort them via bubble. cant seem array initialize. problem occurs within loop. please? bubble works fine when use pre-initialized numbers. ignore print statements.
on line 28, don't declare type int
. it's been initialized when array created. use randomnumbers[k] = (int)(math.random()*10);
also, used randomnumbers
instead of array
reason. don't use array
capital letter. class name, not variable. (worse yet, it's class exists already.)
Comments
Post a Comment