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
|
id: analog_random_source_x
label: Random Source
flags: [ python ]
parameters:
- id: type
label: Output Type
dtype: enum
options: [int, short, byte]
option_attributes:
fcn: [i, s, b]
hide: part
- id: min
label: Minimum
dtype: int
default: '0'
- id: max
label: Maximum
dtype: int
default: '2'
- id: num_samps
label: Num Samples
dtype: int
default: '1000'
- id: repeat
label: Repeat
dtype: enum
default: 'True'
options: ['True', 'False']
option_labels: ['Yes', 'No']
outputs:
- domain: stream
dtype: ${ type }
templates:
imports: |-
from gnuradio import blocks
import numpy
make: blocks.vector_source_${type.fcn}(list(map(int, numpy.random.randint(${min}, ${max},
${num_samps}))), ${repeat})
documentation: |-
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.
This block wraps Vector Source, i.e. it creates a vector source using a vector filled with values returned from calling np.random.randint(min, max, num_samps) once
If you would like a traditional random number generator, use Random Uniform Source instead
file_format: 1
|