Logic Machine Forum
math.random Problem ?! - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: math.random Problem ?! (/showthread.php?tid=2052)



math.random Problem ?! - tom77 - 26.04.2019

Hi,
i have a funny effect when i use the math.random function.
 math.random(1,100) works in a resident script.
 math.random(1,100) in an event-based script always gives 80
i'm currently testing it on a WiserforKNX 2.3.0 but has the same on a Logic machine as well
thanks 

Thomas


RE: math.random Problem ?! - admin - 26.04.2019

Add math.randomseed(os.time()) before math.random()


RE: math.random Problem ?! - tom77 - 26.04.2019

(26.04.2019, 14:15)admin Wrote: Add math.randomseed(os.time()) before math.random()

thank you, it works 


Thomas