mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-04-20 11:23:29 +00:00
Fix seed being impossible to increment/decrement by 1.
This commit is contained in:
parent
a30526aec1
commit
58695f9c7a
@ -20,8 +20,12 @@ export function addRandomizeWidget(node, targetWidget, name, defaultValue = fals
|
|||||||
randomize.afterQueued = () => {
|
randomize.afterQueued = () => {
|
||||||
if (randomize.value) {
|
if (randomize.value) {
|
||||||
const min = targetWidget.options?.min;
|
const min = targetWidget.options?.min;
|
||||||
const max = targetWidget.options?.max;
|
let max = targetWidget.options?.max;
|
||||||
if (min != null || max != null) {
|
if (min != null || max != null) {
|
||||||
|
if (max) {
|
||||||
|
// limit max to something that javascript can handle
|
||||||
|
max = Math.min(1125899906842624, max);
|
||||||
|
}
|
||||||
targetWidget.value = Math.floor(Math.random() * ((max ?? 9999999999) - (min ?? 0) + 1) + (min ?? 0));
|
targetWidget.value = Math.floor(Math.random() * ((max ?? 9999999999) - (min ?? 0) + 1) + (min ?? 0));
|
||||||
} else {
|
} else {
|
||||||
targetWidget.value = Math.floor(Math.random() * 1125899906842624);
|
targetWidget.value = Math.floor(Math.random() * 1125899906842624);
|
||||||
|
Loading…
Reference in New Issue
Block a user