{"push_id":3177702815,"size":24,"distinct_size":24,"ref":"refs/heads/master","head":"d3e3bb83529284122e262455e0c81601c2e836f1","before":"6349a7ea2a359f6f5a843d666ba0519f58b94086","commits":[{"sha":"bab37b38290714ef2dfd3b89e2302d0ccfa409e8","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"Investigation: Revert all changes to the random number generator\n\nWhile RC testing, spotted subtle sonic changes to some of my complex layered instruments.\nCould narrow these down to be somehow related to the changes in random number generation.\nStart an extensive investigation...\n\nRevert \"Changed PRNGs to specifically use uint32_t\"\nThis reverts commit 9c44ec185fe1a69d4fc6f61ea6c447f07735f192.\n\nPartial revert -- retaining all the other changes also packed into this changeset\n               -- only reverting the data type change on the PRNGs\n\nRevert \"Prng behaviour now confirmed and reseeds removed\"\nThis reverts commit 4a2b6f03eab2540a1c26cef838ebb1cf67fd6955.\n\nRevert \"Final tweaks to prng - I think!\"\nThis reverts commit 21aba1e0bc374d6e707a6b9fc5686479e6128696.\n\nRevert \"Further refinements to prng\"\nThis reverts commit 3556e81662023b4173b8cbdce1468234e0137992.\n\nRevert \"Some corrections and improvements to new prng\"\nThis reverts commit 421de825883d9403ff5fa44b28873f100eef13fc.\n\nRevert \"Inplemented a new prng with no external libraries\"\nThis reverts commit 5ff7a65f1ddcf747098ca1f28741428236f37af0.","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/bab37b38290714ef2dfd3b89e2302d0ccfa409e8"},{"sha":"7537d6c5bf463db68c1005c747e1553f2c445db0","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"Refactoring: extract PRNG as nested class\n\nThis changeset (hopefully) does not change any behaviour...\n(with the exception of a minor adjustment on randomINT() in case of #define NORANDOM )\n\nHowever, hopefully it makes the code clearer by encapsulating the state.\nMoreover, this refactoring simplifies experiments with various PRNG algorithms","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/7537d6c5bf463db68c1005c747e1553f2c445db0"},{"sha":"157a573f93ab05a0f5b4656ce950b17f24aaa7f8","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"Refactoring: simplify existing code\n\nIn the standard case, this commit again again (hopefully) changes no functionality.\nThe refactoring relies on knowledge about the implementation of random() and random_r()\n(Based on the source code of Glibc 2.24)\n\n - we know that random_r(&random_buf, &random_result) can not fail (because the first arg is never NULL)\n - we know that random() rsp. random_r() will return values in the range 0...INT_MAX\n\nSimplifications\n - get rid of unneded state in the RandomGen object\n - introduce a new function prngval() for the actual random number generation\n - clarify all integer types to be explicitly 32bit\n - push out the offset on the seed values into the usage location\n   (thus randomINT() gets now a more sensible contract)\n\n*NOTE*: changed the behaviour of randomINT() #ifdef NORANDOM\nIn this case we now return INT_MAX/2\nBasically this gives the behaviour of the former randomOG()\n\nThis minor change might break any test code written against the old NORANDOM behaviour,\nbut since the NORANDOM feature is new, I doubt there is any test code yet ;-)","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/157a573f93ab05a0f5b4656ce950b17f24aaa7f8"},{"sha":"2b998e668e8ad70628f35940d3629bcc0f3de97a","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"Refactoring: move all functions into the RandomGen class body\n\ntrivial refactoring, preparation for the next step.\n(Note: functions defined in a class body are automatically inline in C++)","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/2b998e668e8ad70628f35940d3629bcc0f3de97a"},{"sha":"1076ebb2d35c060e8c3d5eb863300b7d925870ba","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"Refactoring: disentangle the implementation\n\nUp to now, the implementation had various intermingled conditional compilation cases,\nwhich made reasoning about the implementation difficult.\n\nThis commit changes no functionality, but reorganises the code into a dedicated\nimplementation class for each of the possible PRNG implementations. The conditional\ncompilation is now concentrated at a single location, where we define a type alias\nto the actual implementation to be used.\n\n- in this form, it is now simple to add further implementation algorithms\n- moreover, this could be the foundation to make this choice switchable from\n  the instrument definition, with zero overhead (using templates)","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/1076ebb2d35c060e8c3d5eb863300b7d925870ba"},{"sha":"d99b98d4f6f540c9bc1e875dcabac7c0b9bf9293","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"Add the Jenkins 32bit PRNG and use it for all random numbers.\n\nNOTE: other that 1.5.10 RCx, this does *not* change the reseeding, just uses the changed algorithm","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/d99b98d4f6f540c9bc1e875dcabac7c0b9bf9293"},{"sha":"0ab18f289590774b6f4bebf65196c87d5e1b26f5","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"Include a literal copy from the Glibc 2.28 random_r() implementation\n\nThis adds yet another PRNG implementation, which incorporates a literal copy\nfrom the Glibc 2.28 implementation, without any further simplifications.\n\nI use Glibc 2.28 here, since it adds a simplification/clarification for the\nrightshift to drop the least random bit; Since newer C++ standards require\nto use an arithmetic right shift on signed values, the internal variable val\nis now defined to be uint32_t, which also allows to omit the factor  & 0x7fffffff;\nused in previous versinos of the Glibc.\n\nTODO: This changeset includes a huge pile of constants and code\nwhich can be simplified, given that our state array is known to be inline and 256 bytes large","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/0ab18f289590774b6f4bebf65196c87d5e1b26f5"},{"sha":"6e4bc8a745670b21737422afa68d82a11fda333e","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"simplify initstate_r\n\nObservation:\n - we use 256 bytes of state and thus have TYPE_4\n - we never use setstate_r()\n\nThe library uses clever code to capture the current pointer positions of the old state,\nin order to be able to restore that state later. We do not need any of that code.\nIn fact, we now don't use the random_state[0] anymore.","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/6e4bc8a745670b21737422afa68d82a11fda333e"},{"sha":"5faf777f0e9049a2e45cdba549de284911005954","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"further simplify initstate_r(), srandom_r() and random_r()\n\nDirectly using the member fields of the enclosing TrinomialPRNG object greatly simplifies the code.\nMoreover, the constants for the random algorithm are now completely inlined and gone\nAll error exits can be excluded now, and random_r() now returns its result directly.","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/5faf777f0e9049a2e45cdba549de284911005954"},{"sha":"c70eb3353e7ac364750b4b59af1f6854d402ba05","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"reduce state storage\n\n - since we don't use the 1st storage slot in the state array\n   (because we never need to restore an externally saved state),\n   we can shift the whole array by one int32_t. And then we can\n   turn that from an char array into an int32_t array with 64-1 elms.\n\n - then step by step unfold the struct random_data, until only the two\n   active pointers remain. These can be private members of our class","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/c70eb3353e7ac364750b4b59af1f6854d402ba05"},{"sha":"01c3797e3103b7c57cc8ad6f72b05ce5f55f0c43","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"completely inlined and simplified the random_r() / srandom_r() code\n\nBasically all this inlining and rewriting should be equivalent transformations.\nHopefully I made no mistakes...\n\nTo summarise the actual changes:\n\n * the original code used the 1st slot in the state array to capture the pointer positions,\n   in order to be able to save/restore state to an external buffer. We do not need\n   this functionality. Thus I've shifted the whole state array by one int32_t, and adjusted\n   its size to be 63 * 4bytes accordingly. This should have no effect on the algorithm.\n\n * the original code used within srandom_r() the local variables long int lo, high.\n   I consider this dangerous, since long int is the same as int on i386 (a notorious pitfall).\n   Thus I change those variables to be explicitly 64bit.","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/01c3797e3103b7c57cc8ad6f72b05ce5f55f0c43"},{"sha":"cd9e5ea18345c581c31e73157a20374801ea5ff8","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"optimisation: unnecessary to zero-init the state array\n\nthe init() function obviously overwrites systematically the whole content of the state array\n\nAnd, as far as I can see, our code always calls init() before generating random numbers.","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/cd9e5ea18345c581c31e73157a20374801ea5ff8"},{"sha":"963468287cba444b489f9154f445736bdf847590","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"verify the seed initialisation\n\nThe original code used long int for the variables 'hi' and 'lo'\nBut since those traditional types 'int' and 'long' are notoriously fuzzy\nand a constant source of portability problems, I first changed them into int64_t\n\nNow a closer investigation shows that the comment retained from the original code\nis not altogether correct. This clever programming trick only works for seed < INT_MAX,\nbut the srandom() function always accepted an unsigned argument.\n\nFor values INT_MAX < seed <= UINT_MAX (or for the corresponding negative numbers)\nthis calculation diverges from the correct result for (16807 * word) % INT_MAX\n\nHowever, it yields a similar distribution pattern.\nAnd, generally speaking, we are reluctant to change such behaviour without good reason.\n\nThus I've now just changed the variable type to uint32_t\nI have verified (empirically) that this gives the same results as with int64_t","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/963468287cba444b489f9154f445736bdf847590"},{"sha":"389a649fb65e62282eb050330d1c5d314d6080da","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"switch the TrinomaialPRNG algorithm to use uint32_t throughout\n\nIn fact this does not make any difference on the level of the binary numbers,\nand the compiler emits the same assembly.\n\nYet it makes the code way more straight forward, and avoids pitfalls, like e.g.\nwith right shift (which is arithmetic right shift for signed numbers, while we\nwant the classic mere bitshift).\n\nHowever, we retain the seed calculation as-is, to avoid changing behaviour\non INT_MAX < seed < UINT_MAX","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/389a649fb65e62282eb050330d1c5d314d6080da"},{"sha":"9a29eeae760e7b490bacb9fc8885103dfa806464","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"clarify INT_MAX to be INT32_MAX\n\nsince we're now using explicitly fixed 32bit types in the code,\nusing the constant INT_MAX would be an error on platforms where int is not 32bit\n\nAlso, in the known algorithm it is impossible for the random number to be\noutside the expected range, due to: uint32_t result = val >> 1;\n\nfor sake of portability, I use the include <stdint.h>\n(<cstdint> did not define uint32_t for older GCC versions, stdint.h did)","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/9a29eeae760e7b490bacb9fc8885103dfa806464"},{"sha":"f4931965c70fef24b38630fce53cef05ec849d2a","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"clean-up: PRNG init can not fail\n\nThe library version has a failure exit in case the user proivdes a NULL ptr.\nSince we always pass a pointer to our PRNG state embedded in the class,\nthe init() function can not fail. Only the allocation of the class storage,\nwhich would raise an std::exception anyway.\n\nAlso added some comments and reinstated the rot() function from the original\nJenkins implementation, since this makes the code more legible (and the compiler\nwill inline anyway, verified that by looking into the assembly)\n\n** Happy New Year **","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/f4931965c70fef24b38630fce53cef05ec849d2a"},{"sha":"d7f50bc5438f0c7748d0fe74ef2650dda968188f","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"Cross-check and compare my PRNG refactoring with Will's improvements\n\nWhile working on the PRNG, Will did some further improvements and bugfixes.\nThis changeset reinstates these changes, adapted to the recent refactorings.\n\n+ Initially seed the global PRNG from current time, which makes this initial seed truely random.\n  Previously the code used 'samplerate + buffersize + oscilsize', which made\n  the initial seed dependent on some arbitrary contextual information, but didn't\n  make it truely random.\n\n+ Moved this single global reseeding from SynthEngine::Init() up into the SynthEngine-ctor.\n  This changes no functionality, but makes the code more obvious. Init() is always\n  called immediately after creating the global SynthEngine instance.\n\n- However, I did not reinstate any of the changes to the reseed mechanism.\n  Close investigation of the call graphs indicate these changes to be far more\n  intricate as it might look on first sight: The OscilGen::get() function\n  happens from within the NoteOn-Callgraph, and thus re-randomises the\n  PRNGs shared in the OscilGen instances per Kititem-component.\n  Moreover, changing the reseeding this way would also interfer with the\n  global Hrandgrouping parameter, especially when using another oscil within\n  the same AddSynth for modulation.\n\n-----------\nFor context: while RC testing, subtle sonic changes to some complex layered patches\nwere identified to be related to the PRNG reworkings.\n\nFor further investigation and refactoring I then bulk reverted the five\nrelevant changes from Will, which introduced the Jenkins PRNG algorithm.\n\nSubsequently we resorted to using the random_r() algorithm again, but we\nextracted it from Glibc 2.28 and maintain it now in-tree, in order to\nguarantee compatibility with previously created instruments/patches","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/d7f50bc5438f0c7748d0fe74ef2650dda968188f"},{"sha":"bd48e60f70c0be7f84042002043d303ff9c47e0e","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"fix line endings to project standard (CR/LF -> LF)","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/bd48e60f70c0be7f84042002043d303ff9c47e0e"},{"sha":"0ec36a022b5a706a8da049c91c5e885349118501","author":{"name":"Ichthyostega","email":"239fcbd20cdf15221a7123c99df47c85c25a16f1@ichthyostega.de"},"message":"integrate further optimisations by Will\n\nreinstate changes from changesets:\n421de82\n3556e81\n21aba1e\n\nin those cases we used the numRandom() function,\njust to convert the result back and perform further integer asthmatics.\n\nThese can be replaced by calls to randomINT()","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/0ec36a022b5a706a8da049c91c5e885349118501"},{"sha":"8547ec30d4d80717f313201209c36d44d60c4cfb","author":{"name":"abrolag","email":"88f4fbb62bfb992c1f1c7af72aaceb84ac0c3835@musically.me.uk"},"message":"Rationalised some float to int conversions\n\nRemark by committer(Ichthyo, 1/2019):\nWill did this while improving the Jenkins PRNG.\nThis changeset just cherry-picks the float->int optimisations","distinct":true,"url":"https://api.github.com/repos/Yoshimi/yoshimi/commits/8547ec30d4d80717f313201209c36d44d60c4cfb"}]}
{"actor":{"display_login":"abrolag"}}