Returns a random floating point number between 0 and 1 using the two seeds in a repeatable way. - CSharp System

CSharp examples for System:Math Number

Description

Returns a random floating point number between 0 and 1 using the two seeds in a repeatable way.

Demo Code


using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*from  ww  w.  j  a v  a 2s . c  o  m*/

public class Main{
        public static float GetRandom(int xSeed, int ySeed)
        {
            Random r = new Random(xSeed ^ ySeed);
            return (float)r.NextDouble();
        }
}

Related Tutorials