<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>randint Archives - Creatronix</title>
	<atom:link href="https://creatronix.de/tag/randint/feed/" rel="self" type="application/rss+xml" />
	<link>https://creatronix.de/tag/randint/</link>
	<description>My adventures in code &#38; business</description>
	<lastBuildDate>Mon, 06 Jan 2025 09:37:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>numpy random choice</title>
		<link>https://creatronix.de/numpy-random-choice/</link>
		
		<dc:creator><![CDATA[Jörn]]></dc:creator>
		<pubDate>Tue, 03 Jul 2018 10:50:22 +0000</pubDate>
				<category><![CDATA[Data Science & SQL]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[numpy]]></category>
		<category><![CDATA[randint]]></category>
		<category><![CDATA[random choice]]></category>
		<category><![CDATA[random_integers]]></category>
		<guid isPermaLink="false">http://creatronix.de/?p=1697</guid>

					<description><![CDATA[<p>With numpy you can easily create test data with random_integers and randint. numpy.random.randint(low, high=None, size=None, dtype='l') numpy.random.random_integers(low, high=None, size=None) random_integers includes the high boundary while randint does not. &#62;&#62;&#62; import numpy as np &#62;&#62;&#62; np.random.random_integers(5) 4 &#62;&#62;&#62; np.random.random_integers(5, size=(5)) array([5, 3, 4, 1, 4]) &#62;&#62;&#62; np.random.random_integers(5, size=(5, 4)) array([[2, 3, 3, 5], [1, 3, 1,&#8230;</p>
<p>The post <a href="https://creatronix.de/numpy-random-choice/">numpy random choice</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>With numpy you can easily create test data with random_integers and randint.</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>numpy.random.randint(low, high=None, size=None, dtype='l') 
numpy.random.random_integers(low, high=None, size=None)</code></pre>
</div>
<p>random_integers includes the high boundary while randint does not.</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>&gt;&gt;&gt; import numpy as np 
&gt;&gt;&gt; np.random.random_integers(5) 
4</code></pre>
</div>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>&gt;&gt;&gt; np.random.random_integers(5, size=(5)) 
array([5, 3, 4, 1, 4]) 

&gt;&gt;&gt; np.random.random_integers(5, size=(5, 4)) 
array([[2, 3, 3, 5], [1, 3, 1, 3], [5, 3, 3, 4], [1, 5, 2, 5], [2, 5, 4, 5]])</code></pre>
</div>
<p>If You want a random selection of choices from an array you can use</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>&gt;&gt;&gt; import numpy as np 
&gt;&gt;&gt; animals = ['dog', 'cat', 'rabbit'] 
&gt;&gt;&gt; np.random.choice(animals, 9)) 
array(['dog', 'rabbit', 'dog', 'rabbit', 'dog', 'dog', 'cat', 'dog', 'cat'], dtype='|S6')</code></pre>
</div>
<p>The post <a href="https://creatronix.de/numpy-random-choice/">numpy random choice</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
