Random number in ChibiOS

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Random number in ChibiOS

Post by RoccoMarco »

Hi,
I need, if it exists, a function that returns a semi-random or a random number. Someone has any ideas?
Kindly regards
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: Random number in ChibiOS

Post by Tectu »

Take a look at mt19337. That's a well known algorithm to generate pseudo random numbers. It's based on the Mersenne-Twister algorithm.

And because I like you, a direct link for you: http://www.unc.edu/~gfish/rng_afm.c


~ Tectu
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: Random number in ChibiOS

Post by RoccoMarco »

Thank you my friend! :mrgreen:
Post Reply