# Path: src/funfuzz/js/build_options.py
# def chance(i):
#     """Returns a random boolean result based on an input probability.
# 
#     Args:
#         i (float): Intended probability.
# 
#     Returns:
#         bool: Result based on the input probability
#     """
#     return random.random() < i


from functools import lru_cache
from . import inspect_shell
from .build_options import chance
import multiprocessing
import platform
import random
import re
    elif shell_supports_flag(shell_path, "--no-blinterp") and chance(.2):
        # m-c rev 481620:2e490776b07e35013ae07a47798a983f482ffaa3, see bug 1562129
        args.append("--no-blinterp")

    if shell_supports_flag(shell_path, "--more-compartments") and chance(.9):
        # m-c rev 453627:450b8f0cbb4e, see bug 1518753
        args.append("--more-compartments")

    if shell_supports_flag(shell_path, "--no-streams") and chance(.2):
        # m-c rev 442977:c6a8b4d451af, see bug 1501734
        args.append("--no-streams")

    if shell_supports_flag(shell_path, "--spectre-mitigations=on") and chance(.2):
        # m-c rev 399868:a98f615965d7, see bug 1430053
        args.append("--spectre-mitigations=" + ("on" if chance(.9) else "off"))

    # m-c rev 380023:1b55231e6628, see bug 1206770
    if shell_supports_flag(shell_path, "--cpu-count=1"):
        if shell_supports_flag(shell_path, "--ion-offthread-compile=on") and chance(.7):
            # Focus on the reproducible cases
            # m-c rev 188900:9ab3b097f304, see bug 1020364
            args.append("--ion-offthread-compile=" + ("on" if chance(.1) else "off"))
        elif (chance(.5) and multiprocessing.cpu_count() > 1 and
              shell_supports_flag(shell_path, "--cpu-count=1")):
            # Adjusts default number of threads for offthread compilation (turned on by default)
            args.append(f"--cpu-count={random.randint(2, (multiprocessing.cpu_count() * 2))}")

    if shell_supports_flag(shell_path, "--no-off-thread-parse-global") and chance(.5):
        args.append("--no-off-thread-parse-global")


# Path: src/funfuzz/js/build_options.py
# def chance(i):
#     """Returns a random boolean result based on an input probability.
# 
#     Args:
#         i (float): Intended probability.
# 
#     Returns:
#         bool: Result based on the input probability
#     """
#     return random.random() < i


# Path: src/funfuzz/js/shell_flags.py
from functools import lru_cache
from . import inspect_shell
from .build_options import chance
import multiprocessing
import platform
import random
import re

    elif shell_supports_flag(shell_path, "--no-blinterp") and chance(.2):
        # m-c rev 481620:2e490776b07e35013ae07a47798a983f482ffaa3, see bug 1562129
        args.append("--no-blinterp")

    if shell_supports_flag(shell_path, "--more-compartments") and chance(.9):
        # m-c rev 453627:450b8f0cbb4e, see bug 1518753
        args.append("--more-compartments")

    if shell_supports_flag(shell_path, "--no-streams") and chance(.2):
        # m-c rev 442977:c6a8b4d451af, see bug 1501734
        args.append("--no-streams")

    if shell_supports_flag(shell_path, "--spectre-mitigations=on") and chance(.2):
        # m-c rev 399868:a98f615965d7, see bug 1430053
        args.append("--spectre-mitigations=" + ("on" if chance(.9) else "off"))

    # m-c rev 380023:1b55231e6628, see bug 1206770
    if shell_supports_flag(shell_path, "--cpu-count=1"):
        if shell_supports_flag(shell_path, "--ion-offthread-compile=on") and chance(.7):
            # Focus on the reproducible cases
            # m-c rev 188900:9ab3b097f304, see bug 1020364
            args.append("--ion-offthread-compile=" + ("on" if chance(.1) else "off"))
        elif (chance(.5) and multiprocessing.cpu_count() > 1 and
              shell_supports_flag(shell_path, "--cpu-count=1")):
            # Adjusts default number of threads for offthread compilation (turned on by default)
            args.append(f"--cpu-count={random.randint(2, (multiprocessing.cpu_count() * 2))}")

    if shell_supports_flag(shell_path, "--no-off-thread-parse-global") and chance(.5):
        args.append("--no-off-thread-parse-global")


    if shell_supports_flag(shell_path, "--no-cgc") and chance(.1):