Index: binaries/data/mods/public/globalscripts/random.js
===================================================================
--- binaries/data/mods/public/globalscripts/random.js	(nonexistent)
+++ binaries/data/mods/public/globalscripts/random.js	(working copy)
@@ -0,0 +1,43 @@
+/*
+ * Return a random floating point number using Math.random library
+ *
+ * If no parameter given, the returned float is in the interval [0, 1)
+ * If one parameter given, it's maxval, and the returned float is in the interval [0, maxval)
+ * If two parameters are given, they are minval and maxval, and the returned float is in the interval [minval, maxval)
+ */
+function randFloat()
+{
+	if (!arguments.length)
+		return Math.random();
+	else if (arguments.length == 1)
+		return randFloat() * arguments[0];
+	else if (arguments.length == 2)
+		return arguments[0] + randFloat() * (arguments[1] - arguments[0]);
+	else
+	{
+		error("randFloat: invalid number of arguments: "+arguments.length);
+		return undefined;
+	}
+}
+
+/*
+ * Return a random integer using Math.random library
+ *
+ * If no parameter given, the returned integer is in the interval [0, 1]
+ * If one parameter given, it's maxval, and the returned integer is in the interval [0, maxval)
+ * If two parameters are given, they are minval and maxval, and the returned integer is in the interval [minval, maxval]
+ */
+function randInt()
+{
+	if (!arguments.length)
+		return Math.round(randFloat());
+	else if (arguments.length == 1)
+		return Math.floor(randFloat(arguments[0]));
+	else if (arguments.length == 2)
+		return Math.floor(randFloat(arguments[0], arguments[1] + 1));
+	else
+	{
+		error("randInt: invalid number of arguments: "+arguments.length);
+		return undefined;
+	}
+}
Index: binaries/data/mods/public/gui/common/functions_utility.js
===================================================================
--- binaries/data/mods/public/gui/common/functions_utility.js	(revision 18601)
+++ binaries/data/mods/public/gui/common/functions_utility.js	(working copy)
@@ -3,16 +3,6 @@
  */
 var g_LastNickNotification = -1;
 
-function getRandom(randomMin, randomMax)
-{
-	// Returns a random whole number in a min..max range.
-	// NOTE: There should probably be an engine function for this,
-	// since we'd need to keep track of random seeds for replays.
-
-	var randomNum = randomMin + (randomMax-randomMin)*Math.random();  // num is random, from A to B
-	return Math.round(randomNum);
-}
-
 // Get list of XML files in pathname with recursion, excepting those starting with _
 function getXMLFileList(pathname)
 {
Index: binaries/data/mods/public/gui/common/music.js
===================================================================
--- binaries/data/mods/public/gui/common/music.js	(revision 18601)
+++ binaries/data/mods/public/gui/common/music.js	(working copy)
@@ -132,7 +132,7 @@
 
 Music.prototype.getRandomTrack = function(tracks)
 {
-	return tracks[getRandom(0, tracks.length-1)];
+	return shuffleArray(tracks)[0];
 };
 
 Music.prototype.startPlayList = function(tracks, fadeInPeriod, isLooping)
Index: binaries/data/mods/public/gui/loading/loading.js
===================================================================
--- binaries/data/mods/public/gui/loading/loading.js	(revision 18601)
+++ binaries/data/mods/public/gui/loading/loading.js	(working copy)
@@ -14,7 +14,7 @@
 	if (tipTextLoadingArray.length > 0)
 	{
 		// Set tip text
-		let tipTextFilePath = tipTextLoadingArray[getRandom(0, tipTextLoadingArray.length-1)];
+		let tipTextFilePath = shuffleArray(tipTextLoadingArray)[0]
 		let tipText = Engine.TranslateLines(Engine.ReadFile(tipTextFilePath));
 
 		if (tipText)
@@ -63,7 +63,7 @@
 
 	// Pick a random quote of the day (each line is a separate tip).
 	let quoteArray = Engine.ReadFileLines("gui/text/quotes.txt");
-	Engine.GetGUIObjectByName("quoteText").caption = translate(quoteArray[getRandom(0, quoteArray.length-1)]);
+	Engine.GetGUIObjectByName("quoteText").caption = translate(shuffleArray(quoteArray)[0]);
 }
 
 function displayProgress()
Index: binaries/data/mods/public/maps/random/rmgen/random.js
===================================================================
--- binaries/data/mods/public/maps/random/rmgen/random.js	(revision 18601)
+++ binaries/data/mods/public/maps/random/rmgen/random.js	(nonexistent)
@@ -1,54 +0,0 @@
-// TODO: rename/change these functions, so the bounds are more clear
-
-/*
- * Return a random floating point number using Math.random library
- *
- * If no parameter given, the returned float is in the interval [0, 1)
- * If two parameters are given, they are minval and maxval, and the returned float is in the interval [minval, maxval)
- */
-function randFloat()
-{
-	if (arguments.length == 0)
-	{
-		return Math.random();
-	}
-	else if (arguments.length == 2)
-	{
-		var minVal = arguments[0]; 
-		var maxVal = arguments[1];
-		
-		return minVal + randFloat() * (maxVal - minVal);
-	}
-	else
-	{
-		error("randFloat: invalid number of arguments: "+arguments.length);
-		return undefined;
-	}
-}
-
-/*
- * Return a random integer using Math.random library
- *
- * If one parameter given, it's maxval, and the returned integer is in the interval [0, maxval)
- * If two parameters are given, they are minval and maxval, and the returned integer is in the interval [minval, maxval]
- */
-function randInt()
-{	
-	if (arguments.length == 1)
-	{
-		var maxVal = arguments[0]; 
-		return Math.floor(Math.random() * maxVal);
-	}
-	else if (arguments.length == 2)
-	{
-		var minVal = arguments[0];
-		var maxVal = arguments[1];
-		
-		return minVal + randInt(maxVal - minVal + 1);
-	}
-	else
-	{
-		error("randInt: invalid number of arguments: "+arguments.length);
-		return undefined;
-	}
-}

Property changes on: binaries/data/mods/public/maps/random/rmgen/random.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: binaries/data/mods/public/simulation/components/UnitAI.js
===================================================================
--- binaries/data/mods/public/simulation/components/UnitAI.js	(revision 18601)
+++ binaries/data/mods/public/simulation/components/UnitAI.js	(working copy)
@@ -3115,7 +3115,7 @@
 				this.SelectAnimation("walk", false, this.GetWalkSpeed());
 				this.MoveRandomly(+this.template.RoamDistance);
 				// Set a random timer to switch to feeding state
-				this.StartTimer(RandomInt(+this.template.RoamTimeMin, +this.template.RoamTimeMax));
+				this.StartTimer(randInt(+this.template.RoamTimeMin, +this.template.RoamTimeMax));
 				this.SetFacePointAfterMove(false);
 			},
 
@@ -3160,7 +3160,7 @@
 				// Stop and eat for a while
 				this.SelectAnimation("feeding");
 				this.StopMoving();
-				this.StartTimer(RandomInt(+this.template.FeedTimeMin, +this.template.FeedTimeMax));
+				this.StartTimer(randInt(+this.template.FeedTimeMin, +this.template.FeedTimeMax));
 			},
 
 			"leave": function() {

Index: binaries/data/mods/public/simulation/helpers/Random.js
===================================================================
--- binaries/data/mods/public/simulation/helpers/Random.js	(revision 18601)
+++ binaries/data/mods/public/simulation/helpers/Random.js	(nonexistent)
@@ -1,9 +0,0 @@
-/**
- * Returns a random integer from min (inclusive) to max (exclusive)
- */
-function RandomInt(min, max)
-{
-	return Math.floor(min + Math.random() * (max-min));
-}
-
-Engine.RegisterGlobal("RandomInt", RandomInt);

Property changes on: binaries/data/mods/public/simulation/helpers/Random.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
