Skip to content

Commit 3a86c1d

Browse files
committed
demos.vtest: use os rather than urandom.
1 parent 5b3b62f commit 3a86c1d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gui/demos/vtest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# vtest.py Test/demo of VectorDial
22

33
# Released under the MIT License (MIT). See LICENSE.
4-
# Copyright (c) 2019 Peter Hinch
4+
# Copyright (c) 2019-2020 Peter Hinch
55

66
# Updated for uasyncio V3
77

8-
import urandom
8+
import os
99
import time
1010
from cmath import rect, pi
1111
import uasyncio as asyncio
@@ -51,7 +51,7 @@ async def ptr_test(dial):
5151
ptr = Pointer(dial)
5252
v = 0j
5353
steps = 20 # No. of interpolation steps
54-
grv = lambda : urandom.getrandbits(16) / 2**15 - 1 # Random: range -1.0 to +1.0
54+
grv = lambda: (int.from_bytes(os.urandom(1), 1) -128) / 128 # Random: range -1.0 to +1.0
5555
while True:
5656
v1 = grv() + 1j * grv() # Random vector
5757
dv = (v1 - v) / steps # Interpolation vector

0 commit comments

Comments
 (0)