Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 12, 2025

Summary

  • Replaced custom Random instance using DateTime.UtcNow.Ticks.GetHashCode() seed with Random.Shared from .NET 6+
  • Updated documentation comments to reflect the thread-safe nature of Random.Shared
  • Incremented package version to 0.4.0 for next release
  • Updated package release notes

Benefits

  • Thread Safety: Random.Shared provides built-in thread safety, eliminating potential issues with concurrent access
  • Performance: Uses a more efficient implementation optimized for shared usage
  • Modern .NET: Leverages the recommended approach introduced in .NET 6 for shared random number generation
  • Consistency: Ensures consistent random number generation across the application

Test Results

All existing tests pass with the new implementation:

  • DefaultFieldTest - Verifies the Default field is not null
  • NextUInt64Test - Verifies random UInt64 generation with ranges
  • NextBooleanTest - Verifies random boolean generation

The change maintains backward compatibility while providing the benefits of the modern .NET 6+ approach.

🤖 Generated with Claude Code


Resolves #53

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #53
@konard konard self-assigned this Sep 12, 2025
- Changed RandomHelpers.Default from custom Random instance with DateTime.UtcNow.Ticks seed to use System.Random.Shared
- Updated documentation to reflect thread-safe nature of Random.Shared
- Incremented version to 0.4.0 for next release
- Updated package release notes
- All existing tests pass with the new implementation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Replace with Random.Shared from NET 6 Replace with Random.Shared from .NET 6 Sep 12, 2025
@konard konard marked this pull request as ready for review September 12, 2025 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace with Random.Shared from NET 6

2 participants