Skip to main content
. 2026 May 27;28(6):600. doi: 10.3390/e28060600
Algorithm 1 Construction of an (n,k)-simple random integer lattice
Require: lattice rank n, lattice determinant bound M, and k∈[1,n−1]
Ensure: An (n,k)-simple random integer lattice L with det(L)≤M
    Phase 1: Diagonal entries h11,…,hn−1,n−1
    h11=⋯=hkk=1
    d←1
    for i=1 to n−k−1 do
        repeat
            Sample v∼U[0,1] and set x←⌊1/v⌋
            Compute acceptance probability r←x1−s(x+1) with s=n+1−k−i
            Draw u∼U[0,1]
        until u≤r
        d←d·x
        hk+i,k+i←x
    end for
    Phase 2: Final diagonal hnn
    Sample y∼U[0,1]
    hnn←M/d·y1/n
    Phase 3: Off-diagonal entries
    for  j=1 to  n  do
        for i=1 to j−1 do
            hij∼U{0,1,…,hjj−1}
        end for
        for i=j+1 to n do
            hij←0
        end for
    end for
    Phase 4: Output
    Construct H=(hij), return L(H)