Permalink
Browse files

the random generator is faster than the timestamp as talked about in …

…issue #66
  • Loading branch information...
1 parent e224465 commit 33661630c9b62a2353317dc7ec7525b5f2e9a106 @nberardi nberardi committed Sep 25, 2012
Showing with 4 additions and 6 deletions.
  1. +4 −6 src/GuidGenerator.cs
View
@@ -9,7 +9,7 @@ namespace FluentCassandra
/// Used for generating UUID based on RFC 4122.
/// </summary>
/// <seealso href="http://www.ietf.org/rfc/rfc4122.txt">RFC 4122 - A Universally Unique IDentifier (UUID) URN Namespace</seealso>
- public static partial class GuidGenerator
+ public static class GuidGenerator
{
private static readonly Random Random;
@@ -97,11 +97,9 @@ public static GuidVersion GetVersion(this Guid guid)
public static byte[] GetClockSequenceBytes()
{
- var ts = Stopwatch.GetTimestamp();
- return new byte[] {
- (byte)(ts),
- (byte)(ts >> 0x8)
- };
+ var bytes = new byte[2];
+ Random.NextBytes(bytes);
+ return bytes;
}
public static DateTimeOffset GetDateTimeOffset(Guid guid)

0 comments on commit 3366163

Please sign in to comment.