<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: How to Generate Random Numbers in Linux	</title>
	<atom:link href="https://www.ubuntumint.com/generate-random-numbers-linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.ubuntumint.com/generate-random-numbers-linux/</link>
	<description>UbuntuMint - Everything About Ubuntu Linux</description>
	<lastBuildDate>Sat, 28 Sep 2024 05:27:31 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
	<item>
		<title>
		By: Ravi Saive		</title>
		<link>https://www.ubuntumint.com/generate-random-numbers-linux/#comment-53600</link>

		<dc:creator><![CDATA[Ravi Saive]]></dc:creator>
		<pubDate>Sat, 28 Sep 2024 05:27:31 +0000</pubDate>
		<guid isPermaLink="false">https://www.ubuntumint.com/?p=5298#comment-53600</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.ubuntumint.com/generate-random-numbers-linux/#comment-53115&quot;&gt;Charley Herring&lt;/a&gt;.

@Charley

You can link the command to a source file by using &lt;strong&gt;grep&lt;/strong&gt; or &lt;strong&gt;awk&lt;/strong&gt; to check if the generated number matches any in the file. 
&lt;pre&gt;
echo $RANDOM &#124; cut -c 1-3 &#124; grep -Ff sourcefile.txt
&lt;/pre&gt;
This will compare the generated number with entries in the file.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.ubuntumint.com/generate-random-numbers-linux/#comment-53115">Charley Herring</a>.</p>
<p>@Charley</p>
<p>You can link the command to a source file by using <strong>grep</strong> or <strong>awk</strong> to check if the generated number matches any in the file. </p>
<pre>
echo $RANDOM | cut -c 1-3 | grep -Ff sourcefile.txt
</pre>
<p>This will compare the generated number with entries in the file.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Charley Herring		</title>
		<link>https://www.ubuntumint.com/generate-random-numbers-linux/#comment-53115</link>

		<dc:creator><![CDATA[Charley Herring]]></dc:creator>
		<pubDate>Sun, 22 Sep 2024 21:55:39 +0000</pubDate>
		<guid isPermaLink="false">https://www.ubuntumint.com/?p=5298#comment-53115</guid>

					<description><![CDATA[I’m going to be upfront and honest with you. I’m 77 years old and trying to make an extra dollar using the Oklahoma Pick-3 lottery. How would I link this command line (&lt;code&gt;echo $RANDOM &#124; cut -c 1-3&lt;/code&gt;) to a source file of previously picked 3-digit numbers? Or perhaps something else mentioned in the article.]]></description>
			<content:encoded><![CDATA[<p>I’m going to be upfront and honest with you. I’m 77 years old and trying to make an extra dollar using the Oklahoma Pick-3 lottery. How would I link this command line (<code>echo $RANDOM | cut -c 1-3</code>) to a source file of previously picked 3-digit numbers? Or perhaps something else mentioned in the article.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ravi Saive		</title>
		<link>https://www.ubuntumint.com/generate-random-numbers-linux/#comment-12448</link>

		<dc:creator><![CDATA[Ravi Saive]]></dc:creator>
		<pubDate>Tue, 12 Jul 2022 04:38:56 +0000</pubDate>
		<guid isPermaLink="false">https://www.ubuntumint.com/?p=5298#comment-12448</guid>

					<description><![CDATA[Here are some more ways to generate random numbers in Linux.

The below command will generate 3 digits random number.
&lt;pre&gt;
$ echo $RANDOM &#124; cut -c 1-3
&lt;/pre&gt;
The below command will generate 5 digits random number.
&lt;pre&gt;
$ LL=$LANG;LANG=C;L=5;N=;while read -n 1 C; do [[ $C =~ [0-9] ]]&#038;&#038;N+=$C&#038;&#038;((${#N}==L))&#038;&#038;printf &#039;%s&#039; &quot;${N}&quot;&#038;&#038;break;done&#060;/dev/urandom;LANG=$LL
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>Here are some more ways to generate random numbers in Linux.</p>
<p>The below command will generate 3 digits random number.</p>
<pre>
$ echo $RANDOM | cut -c 1-3
</pre>
<p>The below command will generate 5 digits random number.</p>
<pre>
$ LL=$LANG;LANG=C;L=5;N=;while read -n 1 C; do [[ $C =~ [0-9] ]]&amp;&amp;N+=$C&amp;&amp;((${#N}==L))&amp;&amp;printf '%s' "${N}"&amp;&amp;break;done&lt;/dev/urandom;LANG=$LL
</pre>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
