<h3>Contribution description</h3>
<p>This PR fixes the upper bound of <code>random_uint32_range</code> during channel selection. Since this function is defined as <code>a <= x < b</code>, the current implementation picks N-1 channels (instead of N).</p>

<h3>Testing procedure</h3>
<p>Join a NS with ABP using <code>examples/gnrc_lorawan</code>. Send many unconfirmable uplinks. Make sure 3 channels are used.<br>
<a class="user-mention" data-hovercard-type="user" data-hovercard-url="/users/akshaim/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/akshaim">@akshaim</a>, coud you give it a look, since you have all the hardware?</p>

<h3>Issues/PRs references</h3>
<p>Discovered while reading the SDR results in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="803612215" data-permission-text="Title is private" data-url="https://github.com/RIOT-OS/RIOT/issues/15946" data-hovercard-type="pull_request" data-hovercard-url="/RIOT-OS/RIOT/pull/15946/hovercard?comment_id=883370407&comment_type=issue_comment" href="https://github.com/RIOT-OS/RIOT/pull/15946#issuecomment-883370407">#15946 (comment)</a></p>


<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/RIOT-OS/RIOT/pull/16664'>https://github.com/RIOT-OS/RIOT/pull/16664</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>net/gnrc_lorawan: fix random_uint32_range upper bound</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16664/files#diff-131f9af2ffb337cc0013efad3bb5274aff34ea48cb0fc5bb9d379efb15c37fa7">sys/net/gnrc/link_layer/lorawan/gnrc_lorawan_region.c</a>
    (2)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/16664.patch'>https://github.com/RIOT-OS/RIOT/pull/16664.patch</a></li>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/16664.diff'>https://github.com/RIOT-OS/RIOT/pull/16664.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/16664">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYDWSH76MQDTUINLHPTTYYOO7ANCNFSM5AW6NHDQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABE7WYCRP4KQ2DD2RGAAK6LTYYOO7A5CNFSM5AW6NHD2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4OEUFWLA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/16664",
"url": "https://github.com/RIOT-OS/RIOT/pull/16664",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>