.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 18 of file random.py.

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

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 46 of file random.py.

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

◆ random_float()

searx.answerers.random.random_float ( )

Definition at line 27 of file random.py.

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

◆ random_int()

searx.answerers.random.random_int ( )

Definition at line 31 of file random.py.

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

◆ random_sha256()

searx.answerers.random.random_sha256 ( )

Definition at line 36 of file random.py.

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

References random_characters().

+ Here is the call graph for this function:

◆ random_string()

searx.answerers.random.random_string ( )

Definition at line 23 of file random.py.

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

References random_characters().

+ Here is the call graph for this function:

◆ random_uuid()

searx.answerers.random.random_uuid ( )

Definition at line 42 of file random.py.

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