forked from slytherins-hub/lecture_searching
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generators.py
42 lines (32 loc) · 1.08 KB
/
generators.py
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
from random import choices
def unordered_sequence(max_len=100):
"""
Returns list of unordered ints from within a range between -1000 and 1000.
:param max_len: (int) desired length of sequence
:return: (list) sequence of numbers
"""
return choices(range(-1000, 1000), k=max_len)
def ordered_sequence(max_len=100):
"""
Returns list of ordered ints from within a range between -1000 and 1000.
:param max_len: (int) desired length of sequence
:return: (list) sequence of numbers
"""
return sorted(choices(range(-1000, 1000), k=max_len))
def dna_sequence(max_len=100):
"""
Returns string of randomly generated DNA sequence.
:param max_len: (int) desired length of sequence
:return: (str) sequence of basis T, G, A, C
"""
return ''.join(choices('TGAC', k=max_len))
def main():
"""
Test function
:return:
"""
print(unordered_sequence(max_len=500))
print(ordered_sequence(max_len=500))
print(dna_sequence(max_len=500))
if __name__ == "__main__":
main()