My First Object - Linear Congruential Generator


#1

I'd like to put forth my first Axoloti object.

It's an application of the well known Linear Congruential Generator Algorithm as define here:

I found the exercise of creating the object particularly fun, interesting and also challenging.

Previously I had also created a patch with other axo objects that performed the same task. Side by side both setups use comparable CPU but I have no idea in sram - probably less in all likely hood. The original had issues with resetting the algorithm--the object does not suffer from the same problem due to it's triggered seed/reset design.

Here's the patch I made

At this point all of the value inputs and outputs are integers. I honestly don't know the value of fractional types at this point in time. Are there any real advantages to working with fractionals instead of integers? I've read a bit but don't get it quite yet.

Any critique about my object is welcomed. Keep in mind that I have some programming background but none in math, algorithms or computer science in general.

It's not in the community library so you'll have to download it below.

You'll need to pass it values for m, a and c. Seed will start as 0 until you seed the object. You can reset/reseed the algorithm by sampling a value passed to s input by sending a trigger to the Seed trigger input. I'm not entirely sure this is the best method to seed at this moment in time but it seems to work well enough.

lcg.axo (1.9 KB)