I have used the randomSeed function to generate a 'random' value between
0.5 & 2.5 that is used with the delay() command.
I was using the last available analog input (A5) on my UNO Wifi Rev2 to supply the input
value for randomSeed.
I now need that analog input for another field input.
What are my options for still generating a 'random' value ?
Can I reference an active AI with randomSeed even though it is receiving a temp or voltage input?
Or are there restrictions to be considered?
Or if there is a different way to approach a random number generation that would be
ok as well.
It MIGHT actually work BETTER if there is a wide range of unknown-unpredictable analog readings. i.e. If it's more variable-unpredictable than a floating analog input.
If there is human input (like a button press) there are some "tricks" that I have not tried - At the beginning of the program, maybe in setup(), you can run the random function in a loop (before seeding) and when a button is pushed, grab a random number to use as a seed, and then exit the loop.
Or let's say your making a slot machine (or something like that where there is human input before every random number) you run can the random generator continuously in a loop and grab a random number every time the lever is pulled. In that case you don't really need to seed.
Generally, with pseudo random number generators, the seed is just so that you don't get the same sequence, unless you want it. Ideally, you seed only once -- the library will do that anyway if you don't -- and the sequence of internal values that gets generated is random enough for most uses (cryptography is a notable exception). Those internal values can be multiplied and shifted by the library to return results in a desired range.
Deliberately setting multiple seeds makes things less random. You only do that if you want to independently control and reproduce multiple psuedo-random sequences, usually for testing. And because you only have a single generator, you'd have to pull those sequences in advance.
Your question just submerged my head under the water. I do not have a clue about "which core" unfortunately. It is an interesting question nonetheless.
It might have been helpful to provide some background to my need for the random function.
That being that I am dumping a domestic water psi value into a structure array whenever the value changes more than 3 psi up or down. What I discovered is that the stored values were all ending with essentially the same value "right of the decimal point."
Example being: 35.30 ; 38.30 ; 32.30 and so on up and down. So I added the randomSeed value to generate a delay(random) reread of the analog input whenever the input did change up or down by more than 3 psi. I just wanted to see changing values on the right side of the decimal point. Hopefully that is not too weird a desire.... Lol.
The code was setup to only log the input into the structure whenever it
varied by 3 psi, up or down.
And it is so fast that the fractional part hardly ever changes.
I understand what you are saying. My solution was to install a delay() function after the 3 psi change was sensed and before rereading the value; using "randomseed" to generate the milli value between a fixed range.