Ruby | Vector hash() function
Last Updated :
07 Jan, 2020
The hash() is an inbuilt method in Ruby returns hash code of the vector
Syntax: vec1.hash()
Parameters: The function accepts no parameter.
Return Value: It returns hash code of the vector.
Example 1:
require "matrix"
vec1 = Vector[ 1 , 2 , 3 ]
puts vec1.hash()
|
Output:
-2830195808542644263
Example 2:
require "matrix"
vec1 = Vector[ 1 , 1 , 1 ]
puts vec1.hash()
|
Output:
-3301760512247990187
Share your thoughts in the comments
Please Login to comment...