fork download
  1. import java.util.*
  2.  
  3. fun main(args: Array<String>) {
  4.  
  5. val st = Stack<Int>()
  6. val rnd = Random()
  7.  
  8. st.push(10)
  9. st.push(20)
  10. st.push(33)
  11. st.push(9)
  12.  
  13. st.set(1, 1000)
  14.  
  15. for (i in 0 until st.size) {
  16. if (st[i] > 10) {
  17. st[i]++
  18. }
  19. }
  20.  
  21. rnd.setSeed(12345)
  22. println(st)
  23. println(rnd.nextInt(st.size))
  24.  
  25. }
Success #stdin #stdout 0.09s 33424KB
stdin
Standard input is empty
stdout
[10, 1001, 34, 9]
1