Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 29th, 2012  |  syntax: Go  |  size: 0.57 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // arraytest
  2. package main
  3.  
  4. import (
  5.         "math/rand"
  6.         "time"
  7. )
  8.  
  9. const row int = 5000
  10. const col int = 5000
  11.  
  12. var testArray [row][col]int
  13.  
  14. func main() {
  15.  
  16.         // инициализация генератора рандома      
  17.         rand.Seed(time.Now().Unix())
  18.         // заполнение 100-1000
  19.         for i:=0;i<row;i++ {
  20.                 for j:=0;j<col;j++ {
  21.                         testArray[i][j] = 100+rand.Intn(900+1)
  22.                 }
  23.         }
  24.         // заполнение делением с округлением
  25.         for i:=0;i<row;i++ {
  26.                 for j:=0;j<col;j++ {
  27.                         testArray[i][j] = testArray[i][j]/(2+rand.Intn(8+1))
  28.                 }
  29.         }
  30. }