teensy 3.2 random number generation?

Status
Not open for further replies.
Hi,
Is there a random number generator on the Teensy 3.2?
If it doesn't, is there still a way to generate pseudo-random numbers?

Thanks!
 
Is there a random number generator on the Teensy 3.2?

No, it doesn't have the random number hardware that's build into 3.5 & 3.6.

If it doesn't, is there still a way to generate pseudo-random numbers?

Yes. Well, yes and yes.

First, your question asks "pseudo-random numbers", which aren't the same as the actual random number from the random number generator hardware. Of course, you can get pseudo-random numbers from the C library rand() function or Arduino random() function.

For actual random numbers, also yes, you can use the Entropy library. It uses the LPTMR hardware from an internal oscillator and compares it with the crystal oscillator, which is basically the same technique as the dedicated random number generator hardware, but not nearly as fast. Often it's best to get a truly random number from Entropy and use with the srand() to see the pseudo-random sequence, if you will be consuming a lot of numbers. Entropy produces new random numbers at a limited speed.
 
No, it doesn't have the random number hardware that's build into 3.5 & 3.6.

Newb here, can anyone offer a link showing how to call the hardware RNG in the 3.5 and 3.6?
Depending on speed I'd either default to it or just use it once to seed rand() by srand().

Tx,
mike
 

Thanks, much appreciated; this post did come up in my searches, but the context was not clear. What is a K66? Is
the "beta test" title indicating that this function is not yet officially implemented?

Indeed, such register manipulation would probably be beyond my experience level; a c-type library function is about as much as
I can reliably negotiate.

Ever more to learn, and less time to learn it in...

Cheers,

Mike
 
Status
Not open for further replies.
Back
Top