Answers for "c# random range float"

C#
5

c# random float between two numbers

//Notice that I think in order to use System.Random you need to import System (using System;)

static float NextFloat(float min, float max){
  System.Random random = new System.Random();
  double val = (random.NextDouble() * (max - min) + min);
  return (float)val;
}
Posted by: Guest on August-30-2020
0

c# random number between 0 and 1

Random rand = new Random();
return rand.NextDouble; //returns a random number bw 0.0 and 1.0!
Posted by: Guest on April-20-2020

Code answers related to "c# random range float"

C# Answers by Framework

Browse Popular Code Answers by Language