# Ruby program for hash() method in Matrix# Include matrixrequire"matrix"# Initializes the matrix
mat1 =Matrix[[12,21],[31,12]]# Prints the hash-code
puts mat1.hash()
Ruby
输出:
631900695216402634
Ruby
例2 :
# Ruby program for hash() method in Matrix# Include matrixrequire"matrix"# Initializes the matrix
mat1 =Matrix[[6,7],[9,10],[12,4]]# Prints the hash-code
puts mat1.hash()