We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e559730 + 9c1e65f commit 6522c71Copy full SHA for 6522c71
invokeai/app/invocations/math.py
@@ -3,6 +3,7 @@
3
from typing import Literal
4
5
from pydantic import BaseModel, Field
6
+import numpy as np
7
8
from .baseinvocation import BaseInvocation, BaseInvocationOutput, InvocationContext, InvocationConfig
9
@@ -73,3 +74,12 @@ class DivideInvocation(BaseInvocation, MathInvocationConfig):
73
74
75
def invoke(self, context: InvocationContext) -> IntOutput:
76
return IntOutput(a=int(self.a / self.b))
77
+
78
79
+class RandomIntInvocation(BaseInvocation):
80
+ """Outputs a single random integer."""
81
+ #fmt: off
82
+ type: Literal["rand_int"] = "rand_int"
83
+ #fmt: on
84
+ def invoke(self, context: InvocationContext) -> IntOutput:
85
+ return IntOutput(a=np.random.randint(0, np.iinfo(np.int32).max))
0 commit comments