Skip to content

IRandomService

The IRandomService should be used to generate all random values in your game. In IdleKit, random values are used to select random Gacha Rewards and to generate the rewarded amounts. This service's functionality could be overriden so that the seeds and/or random values are generated server-side.

RandomService

IdleKit's concrete implementation of the RandomService uses the System.Random class to generate random seed values, integers, and doubles. However, there are limitations to Random.NextDouble, which does not provide a full range of double values nor an even distribution of values. Please visit https://docs.microsoft.com/en-us/dotnet/api/system.random?view=netframework-4.8#retrieve-floating-point-values-in-a-specified-range for more information.

Overriding the RandomService

If you wish to generate the seeds and/or random values on the server-side, you can implement a concrete class that extends IRandomService and use server calls that return the random values. Once this is implemented, simply change the binding of IRandomService to your new service in the IContainer. See Binding for more information.