Skip to content

Commit

Permalink
fix(matrix, util): increase modifier random string length and optimiz…
Browse files Browse the repository at this point in the history
…e random string generation
  • Loading branch information
Taoning Wang committed Mar 21, 2024
1 parent a046a62 commit 121a36d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frads/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ def rfluxmtx_markup(
Marked up primitives as strings (to be written to a file for rfluxmtx)
"""
modifier_set = {p.modifier for p in surfaces}
source_modifier = f"rflx{surfaces[0].modifier}{random_string(5)}"
source_modifier = f"rflx{surfaces[0].modifier}{random_string(10)}"
if left_hand:
basis = "-" + basis
if source not in ("glow", "light"):
Expand Down
4 changes: 2 additions & 2 deletions frads/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
import re
from pathlib import Path
from random import choice
from random import choices
import string
import subprocess as sp
from typing import Any, Dict, Optional, List, Union
Expand Down Expand Up @@ -529,7 +529,7 @@ def batch_process(
def random_string(size: int) -> str:
"""Generate random characters."""
chars = string.ascii_uppercase + string.digits
return "".join(choice(chars) for _ in range(size))
return "".join(choices(chars, k=size))


def minutes_to_datetime(year: int, minutes: int):
Expand Down

0 comments on commit 121a36d

Please sign in to comment.