File size: 3,855 Bytes
9b50e44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import string
import random
from datetime import datetime, timedelta


def generate_string():
  """Generates a string with VQRQ, 4 random numbers with emphasis on 0 and 1,

  and 6 random characters with emphasis on O, l, and I."""
  # Characters with emphasis on 0 and 1
  emphasized_digits = "0011" * 2 + string.digits[2:]  # Double 0 and 1, then add remaining digits

  numbers = ''.join(random.choice(emphasized_digits) for _ in range(4))

  # Characters with emphasis on O, l, and I
  emphasized_letters = string.ascii_lowercase + "q8gezsrtrnyvlI" + string.digits

  letters = ''.join(random.choice(emphasized_letters) for _ in range(6))
  return f"VQRQ{numbers}{letters}"

def format_number():
  """Formats a number by adding a comma (","), period ("."), or no separator

  for every three digits (thousands) in the integer part, and removes the decimal

  part.



  Args:

      number: The number to format (int or float).

      separator (optional): The separator to use (",", ".", or None for no split).



  Returns:

      The formatted string representation of the number (integer part only).

  """

  number = random.randint(100000, 999999999999)
  # Convert the number to a string and handle negative numbers
  number_str = str(abs(number))  # Get absolute value to handle negatives

  # Split the integer and decimal parts (if any) and discard the decimal part
  integer_part = number_str.split(".")[0]

  # Add commas or periods to the integer part
  if len(integer_part) > 3:
    formatted_integer = ",".join(integer_part[::-1][i:i+3] for i in range(0, len(integer_part), 3))[::-1]
  else:
    formatted_integer = integer_part

  # Combine formatted integer with negative sign (if negative)
  formatted_number = ("-" if number < 0 else "") + formatted_integer

  separator = random.choice(['.', ',', ''])

  formatted_number = formatted_number.replace(",", separator)

  return formatted_number

def generate_random_hour():
  """Generates a random hour in the format HH:MM (or HH:MM:SS) with a random date

  (day, month, year), a random date separator ("/" or "-"), and optional seconds.



  Returns:

      The formatted string representation of the random hour with the specified details.

  """

  # Get a random date within the past year
  max_delta_days = 365  # Adjust for desired date range (e.g., 30 for past month)
  random_delta_days = random.randint(0, max_delta_days)
  random_date = datetime.now() - timedelta(days=random_delta_days)

  # Extract day, month, and year from the random date
  current_year = random_date.year
  current_month = random_date.month
  current_day = random_date.day

  # Generate random hour (0-23) and minute (0-59)
  hour = random.randint(0, 23)
  minute = random.randint(0, 59)

  # Include seconds randomly
  include_seconds = random.choice([True, False])  # Randomly choose True or False

  # Generate random second (optional)
  if include_seconds:
    second = random.randint(0, 59)
  else:
    second = None  # Set to None if not including seconds

  # Choose random date separator
  date_separators = ["/", "-"]
  date_separator = random.choice(date_separators)

  # Format the time string
  time_str = f"{hour:02d}:{minute:02d}"
  if include_seconds:
    time_str += f":{second:02d}"

  # Format the date string with chosen separator
  date_str = f"{current_day}{date_separator}{current_month}{date_separator}{current_year}"

  # Combine time and date strings
  return f"{time_str} {date_str}"


# Open the file in write mode
with open("val_strings.txt", "w") as file:
  for i in range(50000):
    selected_function = random.choice([generate_random_hour, generate_string, format_number])
    strings = selected_function()
    # Write each string to a new line
    file.write(strings + '\n')