Main Site Documentation

Random Seed


#1

I would like to use the pseudo-random number generation capability of NETMF, but in truth it seems reasonably predictable with not a great deal of randomness to it at all. One of the overloads of the instantiation method allows a seed to be used to kick off the randomness of the number returned.

Can anyone suggest a reasonable seed, perhaps number of machine ticks since power on (and how I might obtain that information) for example, that might be useful in improving the randomness of the sequence?


#2

perhaps you can leverage this ?
https://www.ghielectronics.com/community/forum/topic?id=18162


#3

@ Brett - Learnt some things but could still do with a moderately random seed to start things off with. Is there anyway to access the amount of time the MCU has been running, or something similar. I’m afraid there’s not RTC on board.


#4

@ Jason -

Microsoft.SPOT.Hardware

Utility.GetMachineTime Method


#5

Many thanks. I’ll take a look.