If you were still handling message ids as integers in an environment that can't handle signed 64-bit integers you're going to be having a fun time after this update!
13 lines
432 B
C#
13 lines
432 B
C#
using System.Security.Cryptography;
|
|
|
|
namespace SharpChat.Snowflake {
|
|
public class RandomSnowflake(
|
|
SnowflakeGenerator? generator = null
|
|
) {
|
|
public readonly SnowflakeGenerator Generator = generator ?? new SnowflakeGenerator();
|
|
|
|
public long Next(DateTimeOffset? at = null) {
|
|
return Generator.Next(Math.Abs(BitConverter.ToInt64(RandomNumberGenerator.GetBytes(8))), at);
|
|
}
|
|
}
|
|
}
|