I'm trying to define a random potential on the 2D unit square. For some fixed j, I want to decompose the unit square into $2^{2j}$ smaller squares with sides length $2^{-j}$. On each of the smaller squares I want to assign a value of $\{-1,+1\}$ randomly.
I think I want to define a function, e.g.
V[x_,y_]:=Something
where the something takes in [x,y] (a point in the unit square) and returns the value {-1,+1} depending on which grid I landed in.
I'm pretty stuck because I'm not quite sure how to define my V function. I imagined using characteristic functions along with
RandomInteger[{-1, 1}]
but I'm quite stuck and I think I'm missing something really simple.
Would someone care to enlighten me on what I'm missing?
EDIT: The below answer from Carl helps a lot but I run into issues now with defining my differential operator V. So what I want to now do is:
L[x_, y_] := (-Laplacian[#, {x, y}]) + Evaluate[V[x, y]]*# &
But when I try to find the Eigensystem using NDEigensystem I get the error
NearestFunction::neard: The default distance function does not give a real numeric distance when applied to the point pair {x,y} and {1/30,1/30}.
j=2; lattice=Tuples[Subdivide[0,1,2^j],{2}]; Graphics[{Opacity[.5,Yellow],Rectangle[], Red, PointSize[Large],Point@lattice}]
? $\endgroup$