Inheritance: MonoBehaviour
        public override void ApplyForce(float dt, float strength)
        {
            foreach (Body body in World.BodyList)
            {
                //TODO: Consider Force Type
                float decayMultiplier = GetDecayMultiplier(body);

                if (decayMultiplier != 0)
                {
                    FVector2 forceVector;

                    if (ForceType == ForceTypes.Point)
                    {
                        forceVector = body.Position - Position;
                    }
                    else
                    {
                        Direction.Normalize();

                        forceVector = Direction;

                        if (forceVector.Length() == 0)
                        {
                            forceVector = new FVector2(0, 1);
                        }
                    }

                    //TODO: Consider Divergence:
                    //forceVector = Vector2.Transform(forceVector, Matrix.CreateRotationZ((MathHelper.Pi - MathHelper.Pi/2) * (float)Randomize.NextDouble()));

                    // Calculate random Variation
                    if (Variation != 0)
                    {
                        float strengthVariation = (float)Randomize.NextDouble() * MathHelper.Clamp(Variation, 0, 1);
                        forceVector.Normalize();
                        body.ApplyForce(forceVector * strength * decayMultiplier * strengthVariation);
                    }
                    else
                    {
                        forceVector.Normalize();
                        body.ApplyForce(forceVector * strength * decayMultiplier);
                    }
                }
            }
        }
示例#2
0
        private IEnumerable <String> GenerateDrivers()
        {
            List <Driver> drivers = new List <Driver>();

            for (Int32 i = 0; i < 100; i++)
            {
                drivers.Add(new Driver
                {
                    LicenseNumber = Randomize.Numeric(25),
                    Firstname     = Randomize.Text(),
                    Surname       = Randomize.Text()
                });
            }

            defaultContext.Drivers.AddRange(drivers);

            return(drivers.Select(d => d.LicenseNumber));
        }
示例#3
0
        /// <summary>
        /// Serialize compression.
        /// </summary>
        private void SerializeCompression(ByteBuffer writer)
        {
            // determine the byte to write using compression
            switch (Compression)
            {
            case DecompressionMethods.GZip:
                writer.Write((byte)Randomize.Range(0, 35));
                break;

            case DecompressionMethods.None:
                writer.Write((byte)Randomize.Range(36, 177));
                break;

            case DecompressionMethods.Deflate:
                writer.Write((byte)Randomize.Range(178, 255));
                break;
            }
        }
示例#4
0
        public void GetOnlyBufferFiles()
        {
            // Arrange
            var bufferFiles = new FileSizeRolledBufferFiles(directoryService, "SomeBuffer");

            var want = new[]
            {
                "SomeBuffer-20001020.txt",
                "SomeBuffer-20001020_001.txt",
                "SomeBuffer-20001020_010.txt",
                "SomeBuffer-20001020_100.txt",
                "SomeBuffer-20001020_1000.txt",
                "SomeBuffer-20001020_10000.txt"
            };

            directoryService.Files = Randomize.Values(
                want.Concat(new[]
            {
                // Wrong extension
                "SomeBuffer-20001020.config",
                "SomeBuffer-20001020.dll",
                "SomeBuffer-20001020.exe",
                "SomeBuffer-20001020.xml",
                // Wrong file name format
                "SomeBuffer.txt",
                "SomeBuffer.json",
                "XSomeBuffer-20001020.txt",
                "XSomeBuffer-20001020.json",
                "SomeBufferX-20001020.txt",
                "SomeBufferX-20001020.json",
                "SomeBuffer-X20001020.txt",
                "SomeBuffer-X20001020.json",
                "SomeBuffer-20001020X.txt",
                "SomeBuffer-20001020X.json",
                "SomeBuffer-20001020.Xtxt",
                "SomeBuffer-20001020.Xjson"
            }));

            // Act
            var got = bufferFiles.Get();

            // Assert
            got.ShouldBe(want);
        }
示例#5
0
        private void Initgems()
        {
            for (int j = 0; j < gemsvect.Count; j++)
            {
                gemsvect[j] = new Microsoft.Xna.Framework.Vector2(Randomize.GenerateInteger(-10, 10), Randomize.GenerateInteger(-5, 5));
                if (gemsvect[j] == Microsoft.Xna.Framework.Vector2.Zero)
                {
                    gemsvect[j] = new Microsoft.Xna.Framework.Vector2(1, 2);
                }
            }
            int i = 0;

            foreach (Image gem in gems)
            {
                gem.Initialize(new Microsoft.Xna.Framework.Vector2(80, 80));
                gem.Stretch = true;
                gem.Color   = cols[Randomize.GenerateInteger(0, 9)];
                int val = Randomize.GenerateInteger(0, 100);

                if (gemsvect[i].X > 0)
                {
                    valx = 0;
                }
                else
                {
                    valx = 800;
                }

                if (gemsvect[i].Y > 0)
                {
                    valy = Randomize.GenerateInteger(0, 300);
                }
                else
                {
                    valy = Randomize.GenerateInteger(300, 600);
                }

                gem.Position = new Microsoft.Xna.Framework.Vector2(valx, valy);

                gemscol[i].Initialize(gem);

                i++;
            }
        }
示例#6
0
    }  //END START

    void BeginBuildingTiles()
    {
        spawnEdgeValues.Clear();

        int instanceCounter = 0;

        if (tileGroupIterations < 1)
        {
            tileGroupIterations = 1;
        }

        if ((tileGroupRandomize == Randomize.NoRepeats || tileGroupRandomize == Randomize.RepeatsOK) && OrderOfTileGroups.Length < 2)
        {
            tileGroupRandomize = Randomize.Off;
        }

        if (tileGroupRandomize != Randomize.Off)
        {
            // ChooseRandomTileGroup();
        }



        foreach (SoTileMoverTileGroup inList in TileGroups)
        {
            inList.groupId = instanceCounter;
            instanceCounter++;

            if ((inList.randomize == Randomize.RepeatsOK || inList.randomize == Randomize.NoRepeats) &&
                inList.tileList.Count < 2)
            {
                inList.randomize = Randomize.Off;
            }
        }

        GenerateDynamicGroupLists();

        advanceToNextGroup = true;

        if (createOnStart)
        {
            CreateNewChild();
        }
    }
示例#7
0
        public bool ChangeMap(MapChangeDirections direction)
        {
            if (_account.IsBusy || _neighbourMapId != 0)
            {
                _account.Logger.LogWarning("MovementsManager", $"Is busy ({_account.State}) or is already changing the map.");
                return(false);
            }

            // TODO: Maybe make this not sot random (pick the closest cell to change map)
            var changeMapCells = GetChangeMapCells(direction);

            while (changeMapCells.Count > 0)
            {
                short cellId = changeMapCells[Randomize.GetRandomInt(0, changeMapCells.Count)];

                // Ignore this cell if a group of monsters is on it
                if (_account.Game.Map.MonstersGroups.FirstOrDefault(mg => mg.CellId == cellId) != null)
                {
                    continue;
                }

                long neighbourMapId = GetNeighbourMapId(direction);

                if (neighbourMapId <= 0)
                {
                    _account.Logger.LogWarning("MovementsManager", "Invalid Neighbour MapId.");
                    return(false);
                }

                _neighbourMapId = (int)neighbourMapId;

                // Only return true so that if one cell fails, we try the others
                if (MoveToChangeMap(cellId))
                {
                    return(true);
                }

                changeMapCells.Remove(cellId);
            }

            _account.Logger.LogWarning("MovementsManager", "No change map cells found.");
            return(false);
        }
示例#8
0
        private IEnumerable <String> GenerateBuses()
        {
            IEnumerable <String> models = GenerateModels();

            List <Bus> buses = new List <Bus>();

            for (Int32 i = 0; i < 500; i++)
            {
                buses.Add(new Bus
                {
                    Plate     = Randomize.Plate(),
                    ModelName = models.ElementAt(Randomize.Position(models.Count()))
                });
            }

            defaultContext.Buses.AddRange(buses);

            return(buses.Select(b => b.Plate).ToList());
        }
        protected void Send_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                var input = SecretNumber.MakeGuess(int.Parse(GuessTextBox.Text));

                PrevguessLiteral.Text = String.Join(", ", SecretNumber.PreviosGuesses);

                if (input == Outcome.High)
                {
                    Message.Text = "Gissningen var för hög";
                    GuessTextBox.Focus();
                    Result.Visible = true;
                }
                else if (input == Outcome.Low)
                {
                    Message.Text = "Gissningen var för låg";
                    GuessTextBox.Focus();
                    Result.Visible = true;
                }
                else if (input == Outcome.Correct)
                {
                    Message.Text         = "Du gissade rätt!";
                    Result.Visible       = true;
                    GuessTextBox.Enabled = false;
                    Send.Enabled         = false;
                }
                else if (input == Outcome.PreviousGuess)
                {
                    Message.Text = "Du har redan gissat på det talet";
                    GuessTextBox.Focus();
                    Result.Visible = true;
                }
                else if (input == Outcome.NoMoreGuesses)
                {
                    Message.Text = string.Format("Du har använt upp dina gissningar. Det hemltiga talet är {0} , för att spela igen tryck på Slumpa ett nytt tal", SecretNumber.Number);
                    Randomize.Focus();
                    Result.Visible       = true;
                    GuessTextBox.Enabled = false;
                    Send.Enabled         = false;
                }
            }
        }
示例#10
0
        protected KeyValuePair <string, string> GetRandomPair()
        {
            switch (Kana)
            {
            case KanaType.Hiragana:
            {
                var index = Randomize.GetNext(HiraganaConverter.Instance.Alphabet.Count - 1);
                return(HiraganaConverter.Instance.Alphabet.ElementAt(index));
            }

            case KanaType.Katakana:
            {
                var index = Randomize.GetNext(KatakanaConverter.Instance.Alphabet.Count - 1);
                return(KatakanaConverter.Instance.Alphabet.ElementAt(index));
            }

            default: throw new NotImplementedException();
            }
        }
示例#11
0
        public void Delete()
        {
            var directoryNames = Randomize.Array(() => Randomize.String(5, 10, directoryNameSettings), 10);

            foreach (var directoryName in directoryNames)
            {
                var newDirectory = DirectoryPath.Current.CombineDirectory(directoryName);

                Assert.False(newDirectory.Exists);

                newDirectory.Touch();

                Assert.True(newDirectory.Exists);

                newDirectory.Delete();

                Assert.False(newDirectory.Exists);
            }
        }
示例#12
0
        public void FindSiblingDirectory()
        {
            var origin = DirectoryPath.Current.CombineDirectory("tmp").Touch();

            var files = GenerateFiles(origin, Randomize.Int(2, 13), 0);

            foreach (var directory in files.Select(x => x.Parent))
            {
                var foundDirectory = origin.FindSiblingDirectory(directory.Name, ActionOnNotFound.ThrowNewException);

                Assert.Equal(directory, foundDirectory);
                Assert.Equal(directory.Name, foundDirectory.Name);

                var subname          = directory.Name.Substring(Randomize.Int(1, directory.Name.Length - 2));
                var foundDirectories = origin.FindSiblingDirectories(subname);

                Assert.True(foundDirectories.Any());
            }
        }
        // Token: 0x06000164 RID: 356 RVA: 0x00006A8C File Offset: 0x00004E8C
        public static bool TryParse(string texto, out CambiarMapaAccion accion)
        {
            string[] array = texto.Split(new char[]
            {
                '|'
            });
            string input   = array[Randomize.get_Random(0, array.Length)];
            Match  match   = Regex.Match(input, "(?<direction>haut|droite|bas|gauche)\\((?<cell>\\d{1,3})\\)");
            bool   success = match.Success;
            bool   result;

            if (success)
            {
                accion = new CambiarMapaAccion((MapaTeleportCeldas)Enum.Parse(typeof(MapaTeleportCeldas), match.Groups["direction"].Value, true), short.Parse(match.Groups["celda"].Value));
                result = true;
            }
            else
            {
                match = Regex.Match(input, "(?<direction>haut|droite|bas|gauche)");
                bool success2 = match.Success;
                if (success2)
                {
                    accion = new CambiarMapaAccion((MapaTeleportCeldas)Enum.Parse(typeof(MapaTeleportCeldas), match.Groups["direction"].Value, true), -1);
                    result = true;
                }
                else
                {
                    match = Regex.Match(input, "(?<cell>\\d{1,3})");
                    bool success3 = match.Success;
                    if (success3)
                    {
                        accion = new CambiarMapaAccion(MapaTeleportCeldas.AUCUN, short.Parse(match.Groups["cell"].Value));
                        result = true;
                    }
                    else
                    {
                        accion = null;
                        result = false;
                    }
                }
            }
            return(result);
        }
示例#14
0
        public void CombineDirectory()
        {
            var directoryNames = Randomize.Array(() => Randomize.String(5, 10, directoryNameSettings), 10);

            foreach (var directoryName in directoryNames)
            {
                var newDirectory = DirectoryPath.Current.CombineDirectory(directoryName);

                Assert.False(newDirectory.Exists);
                Assert.Equal(directoryName, newDirectory.Name);
                Assert.Equal(DirectoryPath.Current, newDirectory.Parent);

                newDirectory.Touch();

                Assert.True(newDirectory.Exists);
                Assert.True(newDirectory.IsEmpty);
                Assert.Equal(directoryName, newDirectory.Name);
                Assert.Equal(DirectoryPath.Current, newDirectory.Parent);
            }
        }
示例#15
0
        private IEnumerable <String> GenerateRoutes()
        {
            IEnumerable <String> locations = GenerateLocations();

            List <Route> routes = new List <Route>();

            for (Int32 i = 0; i < 100; i++)
            {
                routes.Add(new Route
                {
                    Number        = Randomize.String(40).ToUpper(),
                    DepartureName = locations.ElementAt(Randomize.Position(locations.Count())),
                    ArrivalName   = locations.ElementAt(Randomize.Position(locations.Count()))
                });
            }

            defaultContext.Routes.AddRange(routes);

            return(routes.Select(r => r.Number));
        }
示例#16
0
        /// <summary>
        /// Set the buffer to be sent.
        /// </summary>
        private void SetSendBuffer(BufferQueue buffer, IPEndPoint endPoint)
        {
            _sendBuffer    = buffer;
            TargetEndPoint = endPoint;

            // should the buffer be chunked?
            if (_sendBuffer.Length > MaxDatagramSize)
            {
                // yes, set some of the chunked details
                _chunked    = true;
                _chunkIndex = 0;
                _chunkedId  = Randomize.Range(int.MinValue, int.MaxValue);
                _chunkCount = (int)Math.Ceiling((double)_sendBuffer.Length / (MaxDatagramSize - ChunkHeaderSize));
            }
            else
            {
                // no
                _chunked = false;
            }
        }
示例#17
0
        public void HandleFiveDigitSequenceNumbers()
        {
            // Arrange
            var bufferFiles = new FileSizeRolledBufferFiles(directoryService, "SomeBuffer");

            var want = new[]
            {
                "SomeBuffer-20001020_9999.txt",
                "SomeBuffer-20001020_10000.txt",
                "SomeBuffer-20001020_10001.txt"
            };

            directoryService.Files = Randomize.Values(want);

            // Act
            var got = bufferFiles.Get();

            // Assert
            got.ShouldBe(want);
        }
示例#18
0
        public void HandleFiveDigits()
        {
            // Arrange
            var want = new[]
            {
                "SomeBuffer-20001020_9999.json",
                "SomeBuffer-20001020_10000.json",
                "SomeBuffer-20001020_10001.json"
            };

            directoryService
            .Setup(mock => mock.GetFiles(It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Randomize.Values(want));

            // Act
            var got = bufferFiles.Get();

            // Assert
            got.ShouldBe(want);
        }
示例#19
0
    public static string Obfuscate(string obf, string path, string preset)
    {
        string crDirectory = new FileInfo(path).Directory.FullName;
        string crFile      = path;
        string crPreset    = preset;
        string crProj      = EstablishCRPROJ(crDirectory, crFile, crPreset);
        string crProjFile  = Randomize.String() + ".crproj";

        File.WriteAllText(obf + "\\" + crProjFile, crProj);
        File.WriteAllText(obf + "\\run.bat", "cd \"" + obf + "\"\nConfuser.CLI " + crProjFile);
        Process obfuscationProcess = BatchFile(obf + "\\run.bat");

        obfuscationProcess.Start();
        string confuserOutput = obfuscationProcess.StandardOutput.ReadToEnd();

        obfuscationProcess.WaitForExit();
        File.Delete(obf + "\\" + crProjFile);
        Directory.Delete(obf, true);
        return(confuserOutput);
    }
示例#20
0
        public void FindSiblingFile()
        {
            var origin = DirectoryPath.Current.CombineDirectory("tmp").Touch();

            var files = GenerateFiles(origin, Randomize.Int(2, 13), 0);

            foreach (var file in files)
            {
                var foundFile = origin.FindSiblingFile(file.Name, ActionOnNotFound.ThrowNewException);

                Assert.Equal(file, foundFile);
                Assert.Equal(file.Name, foundFile.Name);
                Assert.Equal(file.Extension, foundFile.Extension);

                var subname    = file.Name.Substring(Randomize.Int(1, file.Name.Length - 2));
                var foundFiles = origin.FindSiblingFiles(subname);

                Assert.True(foundFiles.Any());
            }
        }
示例#21
0
        public void LiteDbDataService_Can_Update_Entity()
        {
            // Set up
            var entity = new EntityMock {
                Name = Randomize.String()
            };

            this.dataService.Insert(entity);

            // Act
            var updateEntity = this.dataService.Get(entity.Id);

            updateEntity.Name = Randomize.String();
            this.dataService.Update(updateEntity);
            var updatedEntity = this.dataService.Get(entity.Id);

            // Assert
            updatedEntity.Name.ShouldBe(updateEntity.Name);
            updatedEntity.Name.ShouldNotBe(entity.Name);
        }
示例#22
0
        public void HandleThreeDigitSequenceNumbersDuringV8Migration()
        {
            // Arrange
            var bufferFiles = new FileSizeRolledBufferFiles(directoryService, "SomeBuffer");

            var want = new[]
            {
                // "json" extension was used < v8
                "SomeBuffer-20001020.json",
                "SomeBuffer-20001020_001.json",
                "SomeBuffer-20001020_002.json",
                "SomeBuffer-20001020_003.json",
                "SomeBuffer-20001020_004.json",
                "SomeBuffer-20001020_005.json",
                "SomeBuffer-20001020_006.json",
                "SomeBuffer-20001020_007.json",
                "SomeBuffer-20001020_008.json",
                "SomeBuffer-20001020_009.json",
                "SomeBuffer-20001020_010.json",
                // "txt" is used from >= v8
                "SomeBuffer-20001020.txt",
                "SomeBuffer-20001020_001.txt",
                "SomeBuffer-20001020_002.txt",
                "SomeBuffer-20001020_003.txt",
                "SomeBuffer-20001020_004.txt",
                "SomeBuffer-20001020_005.txt",
                "SomeBuffer-20001020_006.txt",
                "SomeBuffer-20001020_007.txt",
                "SomeBuffer-20001020_008.txt",
                "SomeBuffer-20001020_009.txt",
                "SomeBuffer-20001020_010.txt"
            };

            directoryService.Files = Randomize.Values(want);

            // Act
            var got = bufferFiles.Get();

            // Assert
            got.ShouldBe(want);
        }
示例#23
0
        public void HandleHours()
        {
            // Arrange
            var want = new[]
            {
                "Buffer-2001123122.json",
                "Buffer-2001123123.json",
                "Buffer-2002010100.json",
                "Buffer-2002010101.json"
            };

            directoryService
            .Setup(mock => mock.GetFiles(It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Randomize.Values(want));

            // Act
            var got = bufferFiles.Get();

            // Assert
            got.ShouldBe(want);
        }
    CustomEvent CreateRental(string[] customers, string[] locations)
    {
        CustomEvent result = new CustomEvent();

        result.Subject     = customers[Randomize.Next(0, customers.Length)];
        result.Location    = locations[Randomize.Next(0, locations.Length)];
        result.Description = "Rent this car";

        int      rangeInDays  = 7;
        int      rangeInHours = 18;
        TimeSpan offset       = TimeSpan.FromDays(Randomize.Next(0, rangeInDays)) + TimeSpan.FromHours(Randomize.Next(0, rangeInHours));

        result.StartTime = baseDate + offset;
        result.EndTime   = result.StartTime + TimeSpan.FromHours(Randomize.Next(1, rangeInHours));
        result.OwnerId   = Randomize.Next(1, 6);
        result.Status    = 2;
        result.Label     = Randomize.Next(0, 7);
        result.Id        = Guid.NewGuid();
        AddEventAdditionalInfo(result);
        return(result);
    }
示例#25
0
        public void LiteDbDataService_Can_Get_Entities_By_Predicate()
        {
            // Set up
            var entity = new EntityMock {
                Name = Randomize.String()
            };
            var entity2 = new EntityMock {
                Name = Randomize.String()
            };

            this.dataService.Insert(entity);
            this.dataService.Insert(entity2);

            // Act
            var readEntities = this.dataService.GetMany(e => e.Name == entity2.Name);

            // Assert
            readEntities.Count().ShouldBe(1);
            readEntities.Single().Id.ShouldBe(entity2.Id);
            readEntities.Single().Name.ShouldBe(entity2.Name);
        }
示例#26
0
        public void LiteDbDataService_Can_Get_All_Entities()
        {
            // Set up
            var entity = new EntityMock {
                Name = Randomize.String()
            };
            var entity2 = new EntityMock {
                Name = Randomize.String()
            };

            this.dataService.Insert(entity);
            this.dataService.Insert(entity2);

            // Act
            var readEntities = this.dataService.GetMany();

            // Assert
            readEntities.Count().ShouldBe(2);
            readEntities.Select(e => e.Id).ShouldContain(entity.Id);
            readEntities.Select(e => e.Id).ShouldContain(entity2.Id);
        }
示例#27
0
        private IEnumerable <Drive> GenerateDrives(IEnumerable <String> routes, IEnumerable <String> buses, IEnumerable <String> drivers)
        {
            DateTime date = new DateTime(DateTime.Now.Year, 4, 1);

            List <Drive> drives = new List <Drive>();

            for (Int32 i = 0; i < 5000; i++)
            {
                drives.Add(new Drive
                {
                    Time               = date.AddHours(i),
                    RouteNumber        = routes.ElementAt(Randomize.Position(routes.Count())),
                    BusPlate           = buses.ElementAt(Randomize.Position(buses.Count())),
                    DriveLicenseNumber = drivers.ElementAt(Randomize.Position(drivers.Count()))
                });
            }

            defaultContext.Drives.AddRange(drives);

            return(drives);
        }
示例#28
0
    public void BuildBuilding(Vector3 position, Transform parent)
    {
        switch (Randomize.Next(0, 1))
        {
        case 0:
            var building = buildingFactory.Create();
            building.transform.SetParent(parent);
            building.transform.localPosition = position;
            building.transform.rotation      = new Quaternion(0, 0, 0, 1);
            building.transform.localScale    = new Vector3(1, 1, 1);
            break;

        case 1:
            var bigBuilding = bigBuildingFactory.Create();
            bigBuilding.transform.SetParent(parent);
            bigBuilding.transform.localPosition = position;
            bigBuilding.transform.rotation      = new Quaternion(0, 0, 0, 1);
            bigBuilding.transform.localScale    = new Vector3(1, 1, 1);
            break;
        }
    }
示例#29
0
        public void HandleYears()
        {
            // Arrange
            var bufferFiles = new TimeRolledBufferFiles(directoryService, "SomeBuffer");

            var want = new[]
            {
                "SomeBuffer-2008.txt",
                "SomeBuffer-2009.txt",
                "SomeBuffer-2010.txt",
                "SomeBuffer-2011.txt"
            };

            directoryService.Files = Randomize.Values(want);

            // Act
            var got = bufferFiles.Get();

            // Assert
            got.ShouldBe(want);
        }
示例#30
0
        private void updateColor()
        {
            if (isShining == false)
            {
                if (Randomize.Boolean(startShineProbability) == true)
                {
                    base.Color = Color.White;

                    isShining = true;
                }
            }
            else
            {
                if (Randomize.Boolean(endShineProbability) == true)
                {
                    base.Color = defaultColor;

                    isShining = false;
                }
            }
        }
 private static void SetRandomizeCurrent(Randomize randomize)
 {
     if (randomize.Enabled && Random.Next(0, 101) >= 100 - randomize.Probability)
     {
         if (randomize.Default > 0)
         {
             var min = randomize.Default / 100f * randomize.Min;
             var max = randomize.Default / 100f * randomize.Max;
             randomize.Current = Random.Next(
                 (int) Math.Floor(Math.Min(min, max)), (int) Math.Ceiling(Math.Max(min, max)) + 1);
         }
         else
         {
             randomize.Current = 0;
         }
     }
     else
     {
         randomize.Current = randomize.Default > 0
             ? Random.Next(
                 (int) Math.Floor(randomize.Default * (randomize.Default >= 50 ? 0.95f : 0.9f)),
                 (int) Math.Ceiling(randomize.Default * (randomize.Default >= 50 ? 1.05f : 1.1f)) + 1)
             : randomize.Default;
     }
 }
 public static void SetRandomizeEnabled(bool value, OrbwalkingRandomize randomize)
 {
     Randomize randomizeEntry;
     if (Randomizes.TryGetValue(randomize, out randomizeEntry))
     {
         randomizeEntry.Enabled = value;
     }
     else
     {
         Randomizes[randomize] = new Randomize { Enabled = value };
     }
 }
 public static void SetRandomizeProbability(float value, OrbwalkingRandomize randomize)
 {
     Randomize randomizeEntry;
     if (Randomizes.TryGetValue(randomize, out randomizeEntry))
     {
         randomizeEntry.Probability = value;
     }
     else
     {
         Randomizes[randomize] = new Randomize { Probability = value };
     }
 }
 public static void SetRandomizeMax(float value, OrbwalkingRandomize randomize)
 {
     Randomize randomizeEntry;
     if (Randomizes.TryGetValue(randomize, out randomizeEntry))
     {
         randomizeEntry.Max = value;
     }
     else
     {
         Randomizes[randomize] = new Randomize { Max = value };
     }
 }
 public static void SetRandomize(float value, OrbwalkingRandomize randomize)
 {
     Randomize randomizeEntry;
     if (Randomizes.TryGetValue(randomize, out randomizeEntry))
     {
         randomizeEntry.Default = value;
         randomizeEntry.Current = value;
     }
     else
     {
         Randomizes[randomize] = new Randomize { Default = value, Current = value };
     }
 }