Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. public int[,] LosowanieLiczb(int[,] TablicaBombowa, int LiczbaBomb)
  2. {
  3. int WylosowanaLiczba;
  4. int Wiersz = 0;
  5. int Kolumna = 0;
  6. Random rnd = new Random();
  7. for (int j = 0; j < LiczbaBomb; j++)
  8. {
  9. WylosowanaLiczba = rnd.Next(1, 100);
  10. Kolumna = WylosowanaLiczba % 10;
  11. Wiersz = (WylosowanaLiczba - Kolumna) % 10;
  12.  
  13. if (TablicaBombowa[Wiersz, Kolumna] != 9)
  14. {
  15. TablicaBombowa[Wiersz, Kolumna] = 9;
  16. Console.WriteLine(j + 1 + ": " + WylosowanaLiczba);
  17. }
  18. else j--;
  19. }
  20. return TablicaBombowa;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement