<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sabrina</title>
    <description>The latest articles on DEV Community by Sabrina (@sabrina).</description>
    <link>https://dev.to/sabrina</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F846873%2F0ca7e4f7-8222-4342-b258-2d6e6bbfbd78.jpeg</url>
      <title>DEV Community: Sabrina</title>
      <link>https://dev.to/sabrina</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sabrina"/>
    <language>en</language>
    <item>
      <title>C random</title>
      <dc:creator>Sabrina</dc:creator>
      <pubDate>Wed, 13 Apr 2022 14:24:34 +0000</pubDate>
      <link>https://dev.to/sabrina/c-random-4489</link>
      <guid>https://dev.to/sabrina/c-random-4489</guid>
      <description>&lt;h2&gt;
  
  
  the definition of rand() &amp;amp; srand()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;rand(): generate random numbers in the range [0, RAND_MAX).&lt;br&gt;
srand(): Set Seed for rand() Function. Standard practice is to use the result of a call to srand(time (0)) as the seed.&lt;/code&gt;&lt;br&gt;
Notes: If random numbers are generated with rand() without first calling srand(), your program will create the same sequence of numbers each time it runs.&lt;/p&gt;

&lt;h2&gt;
  
  
  how to generate a random number in the fixed range
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;int a = rand() % 10;         //[0,9]&lt;br&gt;
int b = rand() % 10 + 5;     //[5,14]&lt;br&gt;
int c = rand() % (upper-lower+1) + lower;    //[lower,upper]&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
