diff --git a/ignite/engine/engine.py b/ignite/engine/engine.py
index e4911aaf..b1d38650 100644
--- a/ignite/engine/engine.py
+++ b/ignite/engine/engine.py
@@ -564,8 +564,8 @@ class Engine:
             epoch_length (int, optional): Number of iterations to count as one epoch. By default, it can be set as
                 `len(data)`. If `data` is an iterator and `epoch_length` is not set, an error is raised.
                 This argument should be `None` if run is resuming from a state.
-            seed (int, optional): Seed to setup at each epoch for reproducible runs.
-                This argument should be `None` if run is resuming from a state.
+            seed (int, optional): Seed to use for dataflow consistency, by default it
+                will respect the global random state. This argument should be `None` if run is resuming from a state.
 
         Returns:
             State: output state.
@@ -594,7 +594,7 @@ class Engine:
             if max_epochs is None:
                 max_epochs = 1
             if seed is None:
-                seed = 12
+                seed = torch.randint(0, int(1e9), (1,)).item()
             if epoch_length is None:
                 if hasattr(data, "__len__"):
                     epoch_length = len(data)

Increase flexibility of setting seed
I was running some code that has randomness during evaluation. However I found that my, supposedly, random preprocessing was always done in exactly the same way.

This is related to setting the random seed by default to 12: https://github.com/pytorch/ignite/blob/master/ignite/engine/engine.py#L583

An alternative mechanism, that respects the user's choice of setting a random seed is to change `seed =12` to:

```seed = torch.randint(100)```

which reads from the manual seed if it was set. 

On Slack it was suggested to use `int(time.time() * 100 % 1000)`, however this still surprises a user that wants to run the same script with two different random seeds and have both seeds reproducible.

I think it's okay if  `torch.randint` changes the random state, because many things in the dataloader already do as well.
diff --git a/tests/ignite/engine/test_engine.py b/tests/ignite/engine/test_engine.py
index 3dfd15a5..bd66f6dc 100644
--- a/tests/ignite/engine/test_engine.py
+++ b/tests/ignite/engine/test_engine.py
@@ -6,6 +6,7 @@ import numpy as np
 import torch
 
 from ignite.engine import Engine, Events, State
+from ignite.metrics import Average
 
 
 def test_terminate():
@@ -529,3 +530,35 @@ def test_engine_with_iterable_dataloader():
     engine.run(data_loader, epoch_length=10, max_epochs=5)
 
     assert counter[0] == 50
+
+
+def test_engine_random_state():
+    def random_data_generator():
+        while True:
+            yield torch.randint(0, 100, size=(5,))
+
+    def sum_data(engine, batch):
+        result = torch.sum(batch)
+        return result
+
+    def get_engine():
+        engine = Engine(sum_data)
+        average = Average()
+        average.attach(engine, "average")
+        return engine
+
+    torch.manual_seed(34)
+    engine = get_engine()
+    state1 = engine.run(random_data_generator(), max_epochs=2, epoch_length=2)
+
+    torch.manual_seed(34)
+    engine = get_engine()
+    state2 = engine.run(random_data_generator(), max_epochs=2, epoch_length=2)
+
+    torch.manual_seed(42)
+    engine = get_engine()
+    state3 = engine.run(random_data_generator(), max_epochs=2, epoch_length=2)
+
+    assert state1.metrics["average"] == pytest.approx(state2.metrics["average"])
+    assert state1.metrics["average"] != pytest.approx(state3.metrics["average"])
+    assert state2.metrics["average"] != pytest.approx(state3.metrics["average"])

pip install -e .
parse_log_pytest
requirements.txt
pytest
apt-get update apt-get install -y gcc pip install torch torchvision -f https://download.pytorch.org/whl/cpu/torch_stable.html -U
3.7
requirements-dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
exceptiongroup==1.2.2
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
numpy==1.21.6
packaging==24.0
Pillow==9.5.0
pluggy==1.2.0
pytest==7.4.4
-e git+https://github.com/pytorch/ignite.git@51c113023dd7f3933aa2d03687dd838ad11c7e7b#egg=pytorch_ignite
requests==2.31.0
tomli==2.0.1
torch==1.13.1+cpu
torchvision==0.14.1+cpu
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0

name: ignite
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - charset-normalizer==3.4.1
      - exceptiongroup==1.2.2
      - idna==3.10
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - numpy==1.21.6
      - packaging==24.0
      - pillow==9.5.0
      - pluggy==1.2.0
      - pytest==7.4.4
      - pytorch-ignite==0.4.0
      - requests==2.31.0
      - tomli==2.0.1
      - torch==1.13.1+cpu
      - torchvision==0.14.1+cpu
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - zipp==3.15.0
prefix: /opt/conda/envs/ignite

tests/ignite/engine/test_engine.py::test_engine_random_state
tests/ignite/engine/test_engine.py::test_terminate tests/ignite/engine/test_engine.py::test_invalid_process_raises_with_invalid_signature tests/ignite/engine/test_engine.py::test_current_epoch_counter_increases_every_epoch tests/ignite/engine/test_engine.py::test_current_iteration_counter_increases_every_iteration tests/ignite/engine/test_engine.py::test_stopping_criterion_is_max_epochs tests/ignite/engine/test_engine.py::test_terminate_at_end_of_epoch_stops_run tests/ignite/engine/test_engine.py::test_terminate_at_start_of_epoch_stops_run_after_completing_iteration tests/ignite/engine/test_engine.py::test_terminate_stops_run_mid_epoch tests/ignite/engine/test_engine.py::test_terminate_epoch_stops_mid_epoch tests/ignite/engine/test_engine.py::test_iteration_events_are_fired tests/ignite/engine/test_engine.py::test_last_event_name tests/ignite/engine/test_engine.py::test_reset_should_terminate tests/ignite/engine/test_engine.py::test_batch_values tests/ignite/engine/test_engine.py::test_state_repr tests/ignite/engine/test_engine.py::test_alter_batch tests/ignite/engine/test_engine.py::test__is_done tests/ignite/engine/test_engine.py::test__setup_engine tests/ignite/engine/test_engine.py::test_run_asserts tests/ignite/engine/test_engine.py::test_state_get_event_attrib_value tests/ignite/engine/test_engine.py::test_run_check_triggered_events tests/ignite/engine/test_engine.py::test_run_check_triggered_events_on_iterator tests/ignite/engine/test_engine.py::test_engine_with_iterable_dataloader
ignite/engine/engine.py
ignite/engine/engine.py