Talk:Pseudo-random numbers/PCG32: Difference between revisions

(The Pseudocode)
Line 18:
==The Pseudocode==
 
Well it is'nt really is it? The purpose of pseudocode is to clearly explain the algorithm. It doesn't does it? Let me look at method seed. It starts by setting state to zero and inc to (seed_sequence << 1) | 1. It then calls next_int() which performs some calculating and returns a value which seed ignores. Strange but wait a sec next_int() has an undocumented side effect it changes the value of state to in this case to inc. seed now adds seed_state to state and calls next_int() again ignoring the return result. The side effect this time is to set state to inc*6364136223846793005+inc. Should not all this be replaced with satate<-((inc+seed_state)*6364136223846793005+inc ? see [http://www.rosettacode.org/wiki/Van_Eck_sequence#Python:_Composition_of_pure_functions] and many others for examples of coding in python without relying on side effects. Those who have copied this without thought should be ashamed of themselves!!!--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 14:04, 13 August 2020 (UTC)
2,171

edits