Copied dotnet code from CosmosDB repository

This commit is contained in:
David Noble
2019-08-20 11:58:29 -07:00
parent b0e89b0dda
commit 31f3bc828b
201 changed files with 37803 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ------------------------------------------------------------
namespace Microsoft.Azure.Cosmos.Serialization.HybridRowGenerator
{
using Microsoft.Azure.Cosmos.Core;
using Microsoft.Azure.Cosmos.Serialization.HybridRow;
public class IntDistribution
{
private readonly int min;
private readonly int max;
private readonly DistributionType type;
public IntDistribution(int min, int max, DistributionType type = DistributionType.Uniform)
{
this.min = min;
this.max = max;
this.type = type;
}
public int Min => this.min;
public int Max => this.max;
public DistributionType Type => this.type;
public int Next(RandomGenerator rand)
{
Contract.Requires(this.type == DistributionType.Uniform);
return rand.NextInt32(this.min, this.max);
}
}
}