diff --git a/3dspin/main.py b/3dspin/main.py index 4cff9f8..dd4ab78 100644 --- a/3dspin/main.py +++ b/3dspin/main.py @@ -3,7 +3,7 @@ ___name___ = "3D Spin" ___license___ = "MIT" ___categories___ = ["Demo"] -___dependencies___ = ["app", "ugfx_helper", "random", "sleep", "buttons"] +___dependencies___ = ["app", "ugfx_helper", "sleep", "buttons"] import ugfx from tilda import Buttons diff --git a/breakout/main.py b/breakout/main.py index 5829ec4..ed5447b 100644 --- a/breakout/main.py +++ b/breakout/main.py @@ -3,7 +3,7 @@ ___name___ = "Breakout" ___license___ = "MIT" ___categories___ = ["Games"] -___dependencies___ = ["app", "ugfx_helper", "random", "buttons"] +___dependencies___ = ["app", "ugfx_helper", "buttons"] from tilda import Buttons import ugfx, ugfx_helper, dialogs diff --git a/game-of-life/main.py b/game-of-life/main.py index 7af9a36..bb577b4 100644 --- a/game-of-life/main.py +++ b/game-of-life/main.py @@ -3,7 +3,7 @@ ___name___ = "Conway game of life" ___license___ = "MIT" ___categories___ = ["Games"] -___dependencies___ = ["app", "ugfx_helper", "random", "sleep", "buttons"] +___dependencies___ = ["app", "ugfx_helper", "sleep", "buttons"] import app, ugfx, ugfx_helper, buttons, sleep, time, random from tilda import Buttons diff --git a/lib/homescreen.py b/lib/homescreen.py index 8702735..5afa460 100644 --- a/lib/homescreen.py +++ b/lib/homescreen.py @@ -17,7 +17,7 @@ They also *may*: """ ___license___ = "MIT" -___dependencies___ = ["database", "buttons", "random", "app", "sleep", "ugfx_helper", "wifi", "sim800"] +___dependencies___ = ["database", "buttons", "app", "sleep", "ugfx_helper", "wifi", "sim800"] import database, ugfx, random, buttons, tilda, sleep, ugfx_helper, wifi, time, sim800 from app import App diff --git a/lib/random.py b/lib/random.py deleted file mode 100644 index d072333..0000000 --- a/lib/random.py +++ /dev/null @@ -1,41 +0,0 @@ -"""Library to generate random numbers - -Warning! Don't use this for anything important, it's probably biased -""" - -___license___ = "MIT" - -# todo: simplify this by using "urandom" -import os - -_bigrand_bytes = 10 -_bigrand_max = pow(256, _bigrand_bytes) - -def _bigrand(): - """generates a random number between 0 (incl) and _bigrand_max (excl)""" - base = 0 - for b in os.urandom(_bigrand_bytes): - base = (base << 8) + b - return base - -def random(): - """Return the next random floating point number in the range [0.0, 1.0).""" - return _bigrand() / _bigrand_max - -def randrange(start, stop=None): - """Return a randomly selected element from range(start, stop)""" - if stop is None: - stop = start - start = 0 - return start + (_bigrand() * (stop - start) // _bigrand_max) - -def randint(start, stop): - """Return a random integer N such that a <= N <= b.""" - return randrange(start, stop + 1) - -def shuffle(seq): - """Shuffle the sequence x in place.""" - l = len(seq) - for i in range(l): - j = randrange(l) - seq[i], seq[j] = seq[j], seq[i] diff --git a/lib/test_random.py b/lib/test_random.py index 5402caa..6c60dad 100644 --- a/lib/test_random.py +++ b/lib/test_random.py @@ -1,7 +1,7 @@ """Tests for random lib""" ___license___ = "MIT" -___dependencies___ = ["upip:unittest", "random"] +___dependencies___ = ["upip:unittest"] import unittest from random import * diff --git a/screendisco/main.py b/screendisco/main.py index 0615914..5fa8dce 100644 --- a/screendisco/main.py +++ b/screendisco/main.py @@ -3,7 +3,7 @@ """ ___name___ = "Screen Party" ___license___ = "MIT" -___dependencies___ = ["ugfx_helper", "sleep", "random"] +___dependencies___ = ["ugfx_helper", "sleep"] ___categories___ = ["Homescreens"] ___bootstrapped___ = False diff --git a/snake/main.py b/snake/main.py index 13761e8..9a29891 100644 --- a/snake/main.py +++ b/snake/main.py @@ -3,9 +3,9 @@ ___name___ = "Snake" ___license___ = "MIT" ___categories___ = ["Games"] -___dependencies___ = ["dialogs", "app", "ugfx_helper", "random", "sleep", "buttons"] +___dependencies___ = ["dialogs", "app", "ugfx_helper", "sleep", "buttons"] -import math, ugfx, ugfx_helper, random, sleep, buttons +import app, math, ugfx, ugfx_helper, random, sleep, buttons from tilda import Buttons ugfx_helper.init()