Random Even Integer

I tried to figure it out myself by looking at old posts, but I haven’t found a way yet. Is it possible to choose a random even integer for h? I added a list to the graph, but I do not know how to reference that list. Any help is much appreciated.


I borrowed this code from a helpful teacher.

r = randomGenerator()

h = r.int(-4,4)
k = r.int(-7, 7)

content: "Below is a randomly generated equation in standard form. Simplify the equation if needed, then draw the graph as accurately as possible.

y=-x^2-${h}x+${k}. "

You can’t generate an even integer directly, but you could define the H to be a random integer, and then make h=2H…

H = r.int(-4,4)
h = numericValue("2*${H}")
k = r.int(-7, 7)
1 Like