summaryrefslogtreecommitdiffstats
path: root/recipes-test/big-update/files/rand_file.py
diff options
context:
space:
mode:
authorStevan Andjelkovic <stevana@users.noreply.github.com>2017-06-19 11:52:20 +0200
committerGitHub <noreply@github.com>2017-06-19 11:52:20 +0200
commite09a0ea7b313b9194c358c06b6aea033bd710ffb (patch)
tree51aa86ea5a7ce48f2c8fa80cfb7300769338743f /recipes-test/big-update/files/rand_file.py
parentce35a47cc7adbe29bdabcc3a090714e80cfc7542 (diff)
parent266f988344d7abbe1a1921caaa813061fc56aa0e (diff)
downloadmeta-updater-e09a0ea7b313b9194c358c06b6aea033bd710ffb.tar.gz
Merge pull request #82 from advancedtelematic/feat/big-update
adds two versions of a random, seeded big file
Diffstat (limited to 'recipes-test/big-update/files/rand_file.py')
-rw-r--r--recipes-test/big-update/files/rand_file.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/recipes-test/big-update/files/rand_file.py b/recipes-test/big-update/files/rand_file.py
new file mode 100644
index 0000000..0f4f16e
--- /dev/null
+++ b/recipes-test/big-update/files/rand_file.py
@@ -0,0 +1,16 @@
1import sys
2from random import seed, randint
3
4def main():
5 n = int(sys.argv[2])
6 ba = bytearray(n)
7
8 seed(42)
9 for i in range(0, n):
10 ba[i] = randint(0, 255)
11
12 with open(sys.argv[1], 'wb') as f:
13 f.write(bytes(ba))
14
15if __name__ == "__main__":
16 main()