Ask Your Question

Dawn's profile - activity

2017-07-14 17:55:26 +0200 received badge  Supporter (source)
2017-07-14 17:20:03 +0200 received badge  Student (source)
2017-07-14 17:05:25 +0200 asked a question I was trying to design random Latin Square. Could you please tell me why this code doesn't work?

Code:

import sys
from sage.all import *
def rand_LS(n):
    m=LatinSquare(n)
    m[0,0]=randint(0,n-1)
    for i in range(0,n-1):
        for j in range(0,n-1):
            while true:
                m[i,j]=randint(0,n-1)
                if (m.is_completable()):
                    break
    return m