Advertisement
Guest User

Untitled

a guest
Apr 14th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.45 KB | None | 0 0
  1.  
  2.  
  3. str="abcdefghijklmnopqrstuvwxyz"
  4. while 0
  5.     rnd=rand(26)
  6.     ch=str[rnd]
  7.     fileName=ch+"2.txt"
  8.     puts fileName
  9.    
  10.     fl = File.open(fileName)
  11.     lineCnt=fl.lines.count
  12.     fl.close
  13.    
  14.     fl=File.open(fileName)
  15.     (1..5).each do |cnt|
  16.         rnd=rand(lineCnt-1)
  17.         puts rnd
  18.     end
  19.     fl.close
  20.    
  21.     puts "Do you want to continue(Type 1 or 2)"
  22.     puts "1)Yes"
  23.     puts "2)No"
  24.    
  25.     inp=gets.chomp 
  26.     if inp=="NO"||inp=="No"||inp=="N"||inp=="n"||inp=="2"
  27.         break
  28.     end
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement