Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const numbers = [75, -18, 216, 21, -6, 352, 39, -68, -318, 182]
- const seed = 42
- function nonrand(i::Int64)
- if(i < 1 || i > length(numbers) + 1)
- throw(BoundsError())
- end
- return numbers[i]
- end
- function random()
- return rand(-999:999)
- end
- x = Array{Int64, 1}(10)
- y = Array{Int64, 1}(10)
- srand(seed)
- for i = 1:10
- x[i] = nonrand(i)
- y[i] = random()
- end
- x = sort(x)
- y = sort(y)
- println("\tNONRAND\tRAND")
- println("MIN\t$(x[1])\t$(y[1])")
- println("MAX\t$(x[10])\t$(y[10])")
- println("MEAN\t$(mean(x))\t$(mean(y))")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement