<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Is there a random number generation function and high-precision system time function that can be called directly？</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/56565/is-there-a-random-number-generation-function-and-high-precision-system-time-function-that-can-be-called-directly</link><description>Now I am using nrf9160DK for development. In my project, I need to use a random number generator and a highly accurate system time stamp. Is there an API that I can call directly? If so, can you tell me the API name, calling method, and header files that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 Jan 2020 10:10:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/56565/is-there-a-random-number-generation-function-and-high-precision-system-time-function-that-can-be-called-directly" /><item><title>RE: Is there a random number generation function and high-precision system time function that can be called directly？</title><link>https://devzone.nordicsemi.com/thread/229377?ContentTypeID=1</link><pubDate>Thu, 16 Jan 2020 10:10:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65262b01-22ef-4417-bd86-97c728d197cc</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;for timestamp purposes you can use the system clock or k_timer functionality in the Zephyr kernel API. Here&amp;#39;s a &lt;a href="https://docs.zephyrproject.org/latest/reference/kernel/timing/timers.html#api-reference"&gt;link to the documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For random number generator the sys_rand32_get() is the correct function to use. You need to remember to set the option&lt;/p&gt;
&lt;p&gt;&lt;span&gt;CONFIG_TEST_RANDOM_GENERATOR&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;in prj.conf.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>