Skip to main content
ciccio
Associate II
Jul 23, 2008 6:05 PM UTC
Question

How I can generate random number?

Posted on July 23, 2008 at 20:05

How I can generate random number?

This topic has been closed for replies.

2 replies

ciccio
ciccioAuthor
Associate II
Jul 23, 2008 6:05 PM UTC
Posted on July 23, 2008 at 20:05

Hi,

there are some libraries for generate random integer?

Now I have used srand() and rand() of Hiware.

srand() setting start value.

rand() generate random integer binded of start value.

star value = ADC1 + ADC2

ADC1= humidity sensor

ADC2= temperature sensor

This not very good algorithm :-[

Other solution? Thanks

I use ST325K6.

Bye

harry_rostovtsev
Associate II
Dec 16, 2013 5:14 AM UTC
Posted on December 16, 2013 at 06:14

I posted this to another thread about random numbers but since you're looking:

This code uses hardware on the stm32f103 to generate true random numbers without having to add any new hardware: http://www.gniibe.org/memo/development/gnuk/rng/pqrng

You probably can't use this directly but should be pretty easy to modify for your needs.