13 lines
395 B
C#
13 lines
395 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);
|
|
}
|
|
}
|