import random
from numpy.random import MT19937
from numpy.random import RandomState, SeedSequence


def combine_seed(*args):
    return ''.join(map(str, args))

def set_random_seed(*args):
    combined_seed = combine_seed(*args)
    random.seed(combined_seed)

def toint(s):
    return [ord(c) for c in s]

def combine_to_int(*args):
    convert=lambda x: toint(str(x))
    return sum(map(convert, args),[])

def get_random_state(*args):
    combined_seed=combine_to_int(*args)
    # print("combined_seed",combined_seed)
    # RandomState(MT19937(SeedSequence(123456789)))
    rs=RandomState(combined_seed)
    return rs