Skip to content
Snippets Groups Projects
Commit c7adcccb authored by shined day's avatar shined day
Browse files

Merge branch '21-amas-add-seed' into 'master'

Resolve "Amas : add seed"

Closes #21

See merge request be-pyamak/pyamak-noyau!24
parents 246fbf26 a0225c07
No related branches found
No related tags found
No related merge requests found
""" """
Environment class Environment class
""" """
from random import seed
import sys import sys
import pathlib import pathlib
...@@ -14,6 +16,16 @@ class Environment(Schedulable): ...@@ -14,6 +16,16 @@ class Environment(Schedulable):
Environment class Environment class
""" """
def __init__(self) -> None: def __init__(self, seed_int: int = None) -> None:
self.set_seed(seed_int)
super().__init__() super().__init__()
self.on_initialization() self.on_initialization()
def set_seed(self, number):
"""
This method set the seed for all random in the system, it should be override to set a custom seed
"""
if number is None:
seed()
return
seed(number)
...@@ -40,4 +40,6 @@ print("--- %s seconds ---" % (time.time() - start_time)) ...@@ -40,4 +40,6 @@ print("--- %s seconds ---" % (time.time() - start_time))
""" """
There are no visible memory leak in pyAmakCore There are no visible memory leak in pyAmakCore
TODO :
We could test add agent / get most critical neighbor ... also
""" """
V0.1.1:
* Add mono threading scheduler
* Add seed in environment
v0.1.0: v0.1.0:
WARNING : all previous example will no longer work in this version, and all v0.1.0+ example won't work in previous version WARNING : all previous example will no longer work in this version, and all v0.1.0+ example won't work in previous version
* Way better thread management * Way better thread management
......
File added
...@@ -3,7 +3,7 @@ from setuptools import setup, find_packages ...@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
setup( setup(
name='pyAmakCore', name='pyAmakCore',
packages=find_packages(), packages=find_packages(),
version='0.1.0', version='0.1.1',
description='AmakFramework in python', description='AmakFramework in python',
author='BE', author='BE',
install_requires=[], install_requires=[],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment