common epic failure of math code that drives me bloody batty bonkers

2 views
Skip to first unread message

Raoul Duke

unread,
Nov 26, 2021, 3:36:07 PM11/26/21
to pi...@googlegroups.com
random() but no way to explicitly seed.

Mike Austin

unread,
Nov 27, 2021, 4:23:09 PM11/27/21
to PiLuD
So, not random... what language is that? That reminds me to add it in Kopi.

Raoul Duke

unread,
Nov 27, 2021, 5:13:34 PM11/27/21
to pi...@googlegroups.com
lots of them? javascript? tinkercad code blocks? et. al.
> --
> You received this message because you are subscribed to the Google Groups "PiLuD" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pilud+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pilud/e6165efa-62ea-40c5-84a4-ceb03c8cd0ecn%40googlegroups.com.

Mike Austin

unread,
Nov 27, 2021, 6:56:28 PM11/27/21
to PiLuD
Oh, I never noticed in JS since I don't use Math.random() much. I notice it is seeded internally, meaning that multiple runs don't produce the same result. If it was truly not seeded, it would always have the same result. What do you need to seed specifically?

Mike Austin

unread,
Nov 27, 2021, 6:58:32 PM11/27/21
to PiLuD
Oh, "The implementation selects the initial seed to the random number generation algorithm; it cannot be chosen or reset by the user."

It would be handy when testing games using the same initial seed for consistent runs while debugging.
Reply all
Reply to author
Forward
0 new messages