Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. trees = [
  2. 'береза повислая',
  3. 'клен ясенелистный',
  4. 'ясень пенсельванский',
  5. 'ива козья',
  6. 'осина обыкновеная'
  7. ]
  8.  
  9. def position
  10. positions_single = [
  11. 'урез воды',
  12. 'мост'
  13. ]
  14.  
  15. positions_plural = [
  16. 'м до уреза воды',
  17. 'м до моста'
  18. ]
  19.  
  20. range = rand(0..5)
  21. if range.zero?
  22. positions_single.sample
  23. else
  24. "#{range} #{positions_plural.sample}"
  25. end
  26. end
  27.  
  28. def random_trees
  29. trees_num = rand(1..4)
  30. trees = []
  31. trees_num.times do
  32. trees << 5 + rand(20)
  33. end
  34. "#{trees_num} #{trees.join(',')}"
  35. end
  36.  
  37. (1..5).each do |i|
  38. p "#{i} #{trees.sample} #{random_trees} #{position}"
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement