Suman Raj

Suman Raj

  • NA
  • 287
  • 12.1k

Generate array values by max picturebox size

Nov 7 2018 12:59 AM
public double[,] GenRanArray(int nbOfRows, int nbOfCols)
{
int MIN_NUMBER = 0;
int MAX_NUMBER = 200; //Max of picture box
// Declare the randomNumber object: randomNumber
Random randomNumber = new Random();
// -----------------------------------

// Create our dynamic array using values passed in.
double[,] newarray = new double[nbOfRows, nbOfCols];

// Initialize the array with random numbers
for (int row = 0; row<nbOfRows; row++)
for (int col = 0; col<nbOfCols; col++)
newarray[row, col] = randomNumber.Next(MIN_NUMBER, MAX_NUMBER);

// Return the array to caller
return newarray;
}
 i have to generate array values by picture box size or bitmap image size after that i fill the colors for the bitmap by the pixel values on each pixel.
 
 
 
 

Answers (1)