diff --git a/fission/src/components/MainHUD.tsx b/fission/src/components/MainHUD.tsx index 9000413d55..c31f06b3e5 100644 --- a/fission/src/components/MainHUD.tsx +++ b/fission/src/components/MainHUD.tsx @@ -11,6 +11,7 @@ import { usePanelControlContext } from "../PanelContext" import { motion } from "framer-motion" import logo from "../assets/autodesk_logo.png" import { ToastType, useToastContext } from "../ToastContext" +import { Random } from "@/util/Random" type ButtonProps = { value: string @@ -156,7 +157,7 @@ const MainHUD: React.FC = () => { "info", "warning", "error", - ][Math.floor(Math.random() * 3)] as ToastType + ][Math.floor(Random() * 3)] as ToastType addToast( type, type, diff --git a/fission/src/components/SelectButton.tsx b/fission/src/components/SelectButton.tsx index 6ab5404288..1bce63c3d5 100644 --- a/fission/src/components/SelectButton.tsx +++ b/fission/src/components/SelectButton.tsx @@ -2,6 +2,7 @@ import React, { useCallback, useEffect, useRef, useState } from "react" import Button, { ButtonSize } from "./Button" import Label, { LabelSize } from "./Label" import Stack, { StackDirection } from "./Stack" +import { Random } from '@/util/Random'; type SelectButtonProps = { colorClass?: string @@ -20,7 +21,7 @@ const SelectButton: React.FC = ({ }) => { const [value, setValue] = useState() const [selecting, setSelecting] = useState(false) - const timeoutRef = useRef() + const timeoutRef = useRef() const onReceiveSelection = useCallback( (value: string) => { @@ -40,12 +41,12 @@ const SelectButton: React.FC = ({ () => { if (selecting) { const v = `node_${Math.floor( - Math.random() * 10 + Random() * 10 ).toFixed(0)}` onReceiveSelection(v) } }, - Math.floor(Math.random() * 2_750) + 250 + Math.floor(Random() * 2_750) + 250 ) } }, [selecting, onReceiveSelection]) diff --git a/fission/src/modals/configuring/theme-editor/ThemeEditorModal.tsx b/fission/src/modals/configuring/theme-editor/ThemeEditorModal.tsx index 7afd659663..3c892ca160 100644 --- a/fission/src/modals/configuring/theme-editor/ThemeEditorModal.tsx +++ b/fission/src/modals/configuring/theme-editor/ThemeEditorModal.tsx @@ -8,6 +8,7 @@ import Button from "@/components/Button" import Dropdown from "@/components/Dropdown" import Modal, { ModalPropsImpl } from "@/components/Modal" import Stack, { StackDirection } from "@/components/Stack" +import { Random } from "@/util/Random" import { extend as cdExtend, random as cdRandom, colord } from "colord" import a11yPlugin from "colord/plugins/a11y" import React, { useState } from "react" @@ -127,7 +128,7 @@ const ThemeEditorModal: React.FC = ({ modalId }) => { if (selectedTheme == initialThemeName) return; const keys: ColorName[] = Object.keys(themes[selectedTheme]) as ColorName[]; keys.forEach(k => { - const randAlpha = () => Math.max(0.1, Math.random()); + const randAlpha = () => Math.max(0.1, Random()); updateColor(selectedTheme, k, { ...cdRandom().toRgb(), a: randAlpha() } as RgbaColor); }) applyTheme(selectedTheme)