﻿using UnityEngine;
using UnityEngine.Networking;

#pragma warning disable 0618

namespace SyncUtil
{
    public interface IInstanceRandom
    {
        CustomRandom rand { get; }
    }


    public class InstanceRandom : NetworkBehaviour, IInstanceRandom
    {
        [SyncVar]
        protected int seed;

        public void Awake()
        {
            seed = Random.Range(int.MinValue, int.MaxValue);
        }

        CustomRandom _rand;
        public CustomRandom rand { get { return (_rand ?? (_rand = new CustomRandom(seed))); } }
    }
}

{'avg_line_length': 19.714285714285715, 'max_line_length': 96, 'alphanum_fraction': 0.6159420289855072, 'licenses': ['MIT'], 'repository_name': 'Innovative-Ideas/SyncUtil', 'path': 'Scripts/InstanceRandom.cs', 'size': 554, 'lang': 'C#'}