Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Fix seed being impossible to increment/decrement by 1.

comfyanonymous58695f9c7ad2
diff --git a/web/scripts/widgets.js b/web/scripts/widgets.js
index 8c78d9551..5f5043cd0 100644
--- a/web/scripts/widgets.js
+++ b/web/scripts/widgets.js
@@ -20,8 +20,12 @@ export function addRandomizeWidget(node, targetWidget, name, defaultValue = fals
randomize.afterQueued = () => {
if (randomize.value) {
const min = targetWidget.options?.min;
- const max = targetWidget.options?.max;
+ let max = targetWidget.options?.max;
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));
} else {
targetWidget.value = Math.floor(Math.random() * 1125899906842624);