From 4b523f34a4a9b259e40f498ec117ccfa9e473214 Mon Sep 17 00:00:00 2001 From: Aart van Halteren Date: Wed, 17 Jul 2013 12:50:44 +0200 Subject: [PATCH] start at random position in file --- smartmeter.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/smartmeter.rb b/smartmeter.rb index 666bc83..127a6c9 100644 --- a/smartmeter.rb +++ b/smartmeter.rb @@ -22,6 +22,8 @@ def open_device rescue p "Serialport Error - reverting to '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 return io_device end