INNER CODE UNIT · Python
rand_num
RQLuo/MixTeX-Latex-OCR · mixtex_data_gen/gen.py:111
rand_num = random.randint(-99, 99) / random.randint(1, 99)
rand_float = str(round(rand_num, random.randint(1, 4)))
output += ' \\(' + rand_float + '\\) '
elif random.random() < 0.007:
rand_str = ''.join(random.choices(string.ascii_letters, k=random.randint(1, 3)))
output += ' \\(' + rand_str + '\\) '
if random.random() < 0.001:
output += ' \\([' + str(random.randint(1, 100)) + ']\\) '
if random.random() < 0.0005:
char = random.sample(lines, 1)[0].replace('\n', '')
if random.random() < 0.5:
output += ' \\textbf{' + char + '} '
else:
output += ' \\textit{' + char + '} '
return output
# Function to write LaTeX formatted strings into separate .tex files
# Input: