# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import numpy as np

import megengine as mge
import megengine.functional as F
import megengine.jit as jit
import megengine.module as M
import megengine.random as R


def test_random_static_diff_result():
    @jit.trace(symbolic=True)
    def graph_a():
        return R.uniform(5) + R.gaussian(5)

    @jit.trace(symbolic=True)
    def graph_b():
        return R.uniform(5) + R.gaussian(5)

    a = graph_a()
    b = graph_b()
    assert np.any(a.numpy() != b.numpy())


def test_random_static_same_result():
    @jit.trace(symbolic=True)
    def graph_a():
        R.manual_seed(731)
        return R.uniform(5) + R.gaussian(5)

    @jit.trace(symbolic=True)
    def graph_b():
        R.manual_seed(731)
        return R.uniform(5) + R.gaussian(5)

    a = graph_a()
    b = graph_b()
    assert np.all(a.numpy() == b.numpy())


def test_random_dynamic_diff_result():
    a = R.uniform(5) + R.gaussian(5)
    b = 
R.uniform(5)