diff --git a/pyof/v0x01/common/header.py b/pyof/v0x01/common/header.py
index 1e62b87..c0489e5 100644
--- a/pyof/v0x01/common/header.py
+++ b/pyof/v0x01/common/header.py
@@ -73,7 +73,7 @@ class Header(GenericStruct):
     length = UBInt16()
     xid = UBInt32()
 
-    def __init__(self, message_type=None, length=None, xid=randint(0, MAXID)):
+    def __init__(self, message_type=None, length=None, xid=None):
         """The constructor takes the optional parameters below.
 
         Args:
@@ -84,4 +84,4 @@ class Header(GenericStruct):
         super().__init__()
         self.message_type = message_type
         self.length = length
-        self.xid = xid
+        self.xid = randint(0, MAXID) if xid is None else xid

diff --git a/tests/v0x01/test_common/test_header.py b/tests/v0x01/test_common/test_header.py
index 003621c..3c01fd8 100644
--- a/tests/v0x01/test_common/test_header.py
+++ b/tests/v0x01/test_common/test_header.py
@@ -1,6 +1,7 @@
 """Testing Header structure."""
 import os
 import unittest
+from unittest.mock import patch
 
 from pyof.v0x01.common.header import Header, Type
 
@@ -43,3 +44,9 @@ class TestHeader(unittest.TestCase):
         self.assertEqual(self.message.version, 1)
 
         f.close()
+
+    @patch('pyof.v0x01.common.header.randint')
+    def test_random_xid(self, m):
+        """Each Header instantiations without xid should call randint."""
+        Header(), Header()  # noqa
+        self.assertEqual(m.call_count, 2)

Fix Header's random xid
One single random value is used during all code execution.
tests/v0x01/test_common/test_header.py::TestHeader::test_random_xid
tests/v0x01/test_common/test_header.py::TestHeader::test_pack tests/v0x01/test_common/test_header.py::TestHeader::test_size tests/v0x01/test_common/test_header.py::TestHeader::test_unpack