Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
Fix for Overflow error in CCRandom on 4S device.
Browse files Browse the repository at this point in the history
Add unchecked when creating the SystemRandom seed for iOS devices new System.Random(unchecked((int)DateTime.UtcNow.Ticks));

See issue #282
  • Loading branch information
kjpou1 committed Aug 11, 2015
1 parent b35bf3b commit 1aeef38
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Math/CCRandom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ namespace CocosSharp
public class CCRandom
{
// random seed
#if IOS
private static System.Random _random = new System.Random(unchecked((int)DateTime.UtcNow.Ticks));
#else
private static System.Random _random = new System.Random((int)DateTime.UtcNow.Ticks);
#endif

public static void Randomize(int seed)
{
Expand Down

0 comments on commit 1aeef38

Please sign in to comment.