-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfunctions.py
31 lines (27 loc) · 1.04 KB
/
functions.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
import string
import random
class Functions:
def get_random_digit():
return random.randint(0,9)
get_random_digit_JSON = {
"name": "get_random_digit",
"description": "Get a random digit",
"parameters": {
"type": "object",
"properties": {},
}
}
def get_random_letters(count: int, case_sensitive: bool = False):
return ''.join(random.choices(string.ascii_letters if case_sensitive else string.ascii_uppercase, k=count))
get_random_letters_JSON = {
"name": "get_random_letters",
"description": "Get a string of random letters",
"parameters": {
"type": "object",
"properties": {
"count": {"type": "integer", "description": "Number of letters to return"},
"case_sensitive": {"type": "boolean", "description": "Whether to include lower-case letters. Default only returns upper-case letters."}
},
"required": ["count"]
}
}