Random number question

All technical discussions and projects around startKIT
JLS
Member++
Posts: 18
Joined: Fri Feb 14, 2014 11:21 am

Random number question

Post by JLS »

Hi all

Is possible make random number generator with random first state ? (like true random)

I´m testing random routine from StartKit example projects (app_noughts_and_crosses) but not working - first value when ON StartKit is same value like before previous ON !

Second question - c++ function rand() or random() not implement in compiller ?

Thanks info

Kamil


User avatar
infiniteimprobability
XCore Legend
Posts: 1124
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

Yep - should be possible, depending on your definition of random!

There's a free running ring oscillator in each tile which varies based on PVT which can be used as a seed, so pretty difficult to predict without detailed knowledge of you power supply rail, die temperature and batch code of the chip. Should be random enough for gaming ;-)

https://github.com/xcore/sc_util/tree/m ... ule_random
JLS
Member++
Posts: 18
Joined: Fri Feb 14, 2014 11:21 am

Post by JLS »

Thanks reply

nice module - this weekend test it :-)
User avatar
Ross
XCore Expert
Posts: 783
Joined: Thu Dec 10, 2009 9:20 pm

Post by Ross »

JLS wrote: Second question - c++ function rand() or random() not implement in compiller ?

FYI, rand() etc are in stdlib.h