.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.answerers.random Namespace Reference

Classes

class  SXNGAnswerer

Functions

 random_characters ()
 random_string ()
 random_float ()
 random_int ()
 random_sha256 ()
 random_uuid ()
 random_color ()

Function Documentation

◆ random_characters()

searx.answerers.random.random_characters ( )

Definition at line 17 of file random.py.

17def random_characters():
18 random_string_letters = string.ascii_lowercase + string.digits + string.ascii_uppercase
19 return [random.choice(random_string_letters) for _ in range(random.randint(8, 32))]
20
21

Referenced by random_sha256(), and random_string().

Here is the caller graph for this function:

◆ random_color()

searx.answerers.random.random_color ( )

Definition at line 45 of file random.py.

45def random_color():
46 color = "%06x" % random.randint(0, 0xFFFFFF)
47 return f"#{color.upper()}"
48
49

◆ random_float()

searx.answerers.random.random_float ( )

Definition at line 26 of file random.py.

26def random_float():
27 return str(random.random())
28
29

◆ random_int()

searx.answerers.random.random_int ( )

Definition at line 30 of file random.py.

30def random_int():
31 random_int_max = 2**31
32 return str(random.randint(-random_int_max, random_int_max))
33
34

◆ random_sha256()

searx.answerers.random.random_sha256 ( )

Definition at line 35 of file random.py.

35def random_sha256():
36 m = hashlib.sha256()
37 m.update(''.join(random_characters()).encode())
38 return str(m.hexdigest())
39
40

References random_characters().

Here is the call graph for this function:

◆ random_string()

searx.answerers.random.random_string ( )

Definition at line 22 of file random.py.

22def random_string():
23 return ''.join(random_characters())
24
25

References random_characters().

Here is the call graph for this function:

◆ random_uuid()

searx.answerers.random.random_uuid ( )

Definition at line 41 of file random.py.

41def random_uuid():
42 return str(uuid.uuid4())
43
44