start at random position in file

This commit is contained in:
Aart van Halteren
2013-07-17 12:50:44 +02:00
parent 8e7fd64701
commit 4b523f34a4

View File

@@ -22,6 +22,8 @@ def open_device
rescue rescue
p "Serialport Error - reverting to 'example_blurp.txt'" p "Serialport Error - reverting to 'example_blurp.txt'"
io_device = File.open("example_blurp.txt") io_device = File.open("example_blurp.txt")
# start at random place in the file
io_device.seek(rand(1500), IO::SEEK_SET)
end end
return io_device return io_device
end end