Revision history [back]

I was trying to design random Latin Square. Could you please tell me why this code doesn't work?

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

 2 None kcrisman 12242 ●42 ●135 ●255

I was trying to design random Latin Square. Could you please tell me why this code doesn't work?

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

 3 None kcrisman 12242 ●42 ●135 ●255

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

 4 None kcrisman 12242 ●42 ●135 ●255

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 mm

 5 None vdelecroix 7585 ●20 ●83 ●167 http://www.labri.fr/pe...

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