Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Random span-based API #13708

Merged
merged 3 commits into from
Aug 31, 2017
Merged

Conversation

MaggieTsang
Copy link

@MaggieTsang MaggieTsang commented Aug 30, 2017

Added NextBytes functionality for Span to Random class outlined in https://github.com/dotnet/corefx/issues/22356.

for (int i = 0; i < buffer.Length; i++)
{
buffer[i] = (byte)(InternalSample() % (Byte.MaxValue + 1));
buffer[i] = (byte)InternalSample();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove % (Byte.MaxValue + 1)); ? Although, I'm not sure what it was for.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I think it's redundant, the byte cast is enough. Fine.

Copy link
Member

@danmoseley danmoseley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stephentoub any comments?

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@stephentoub stephentoub merged commit 6c41724 into dotnet:master Aug 31, 2017
dotnet-bot pushed a commit to dotnet/corert that referenced this pull request Sep 1, 2017
* Span NextBytes

* int fixes

* undo ints

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
jkotas pushed a commit to dotnet/corert that referenced this pull request Sep 1, 2017
* Span NextBytes

* int fixes

* undo ints

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants