Guest User

Untitled

a guest
Sep 14th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.61 KB | None | 0 0
  1. import std.random;
  2. import std.stdio;
  3. import std.array;
  4. import std.math;
  5.  
  6. void main()
  7. {
  8.     int i,j;
  9.     const int row = 5000;
  10.     const int col = 5000;
  11.     // создаём матрицу
  12.     int[][] testArray = uninitializedArray!(int[][])(row,col);
  13.     // заполняем рандомом 100 - 1000
  14.     for (i=0; i<row; ++i) {
  15.         for (j=0; j<col; ++j) {
  16.             testArray[i][j] = cast(int)uniform(100, 1000);
  17.         }
  18.     }
  19.     // делим имеющиеся на рандом 2 - 10 и округляем
  20.     for (i=0; i<row; ++i) {
  21.         for (j=0; j<col; ++j) {
  22.             testArray[i][j] = cast(int)round(testArray[i][j]/uniform(2, 10));
  23.         }
  24.     }
  25. }
Add Comment
Please, Sign In to add comment