summaryrefslogtreecommitdiff
path: root/grc/data/platforms/python/blocks/random_source_x.xml
blob: 800bae7167ea3647bb7a5e414baae57a6eaded3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?xml version="1.0"?>
<!--
###################################################
##Random Source:
##	Custom block
###################################################
 -->
<block>
	<name>Random Source</name>
	<key>random_source_x</key>
	<import>from gnuradio import gr</import>
	<import>import numpy</import>
	<make>gr.vector_source_$(type.fcn)(map(int, numpy.random.randint($min, $max, $num_samps)), $repeat)</make>
	<param>
		<name>Output Type</name>
		<key>type</key>
		<type>enum</type>
		<option>
			<name>Int</name>
			<key>int</key>
			<opt>fcn:i</opt>
		</option>
		<option>
			<name>Short</name>
			<key>short</key>
			<opt>fcn:s</opt>
		</option>
		<option>
			<name>Byte</name>
			<key>byte</key>
			<opt>fcn:b</opt>
		</option>
	</param>
	<param>
		<name>Minimum</name>
		<key>min</key>
		<value>0</value>
		<type>int</type>
	</param>
	<param>
		<name>Maximum</name>
		<key>max</key>
		<value>2</value>
		<type>int</type>
	</param>
	<param>
		<name>Num Samples</name>
		<key>num_samps</key>
		<value>1000</value>
		<type>int</type>
	</param>
	<param>
		<name>Repeat</name>
		<key>repeat</key>
		<value>True</value>
		<type>enum</type>
		<option>
			<name>Yes</name>
			<key>True</key>
		</option>
		<option>
			<name>No</name>
			<key>False</key>
		</option>
	</param>
	<source>
		<name>out</name>
		<type>$type</type>
	</source>
	<doc>
Generate num samples of random numbers of [min, max). Repeat samples if specified.

Ex: With min=0 and max=2, the sequence 01110101... will be generated.
	</doc>
</block>