2 types derived from Random
Microsoft.ML.Core (1)
Utilities\Random.cs (1)
86internal sealed class TauswortheHybrid : Random
System.Private.CoreLib (1)
src\libraries\System.Private.CoreLib\src\System\Random.cs (1)
461private sealed class ThreadSafeRandom : Random
314 instantiations of Random
HttpStress (1)
Program.cs (1)
636_random = new Random(Combine(seed, taskNum)); // derived from global seed and worker number
IdeBenchmarks (1)
SQLitePersistentStorageBenchmark.cs (1)
72_random = new Random(0);
KeyManagementSimulator (2)
Program.cs (2)
93var productRandom = new Random(seed); 94var simulatorRandom = new Random(productRandom.Next());
Microsoft.Arcade.Common (1)
ExponentialRetry.cs (1)
13private Random _random = new Random();
Microsoft.AspNetCore.Components.Server.Tests (2)
Circuits\RemoteJSDataStreamTest.cs (2)
52var random = new Random(); 80var random = new Random();
Microsoft.AspNetCore.InternalTesting.Tests (1)
QuarantinedTestAttributeTest.cs (1)
27Assert.True(new Random().Next(100) <= 80);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (2)
BufferWriterTests.cs (1)
219new Random(length).NextBytes(data);
src\Shared\test\Shared.Tests\runtime\Http2\HuffmanDecodingTests.cs (1)
133new Random(42).NextBytes(data);
Microsoft.AspNetCore.Shared.Tests (1)
runtime\Http2\HuffmanDecodingTests.cs (1)
133new Random(42).NextBytes(data);
Microsoft.Build (1)
StringUtils.cs (1)
29Random random = new();
Microsoft.Build.Engine.UnitTests (2)
BuildEventArgsSerialization_Tests.cs (1)
524(AssemblyLoadingContext)(new Random().Next(Enum.GetNames(typeof(AssemblyLoadingContext)).Length));
Evaluation\Expander_Tests.cs (1)
1642xmlattribute.Value = "abc123" + new Random().Next();
Microsoft.Build.Framework (1)
Telemetry\OpenTelemetryManager.cs (1)
233Random random = new();
Microsoft.Build.Framework.UnitTests (1)
AssemblyLoadBuildEventArgs_Tests.cs (1)
22(AssemblyLoadingContext)(new Random().Next(Enum.GetNames(typeof(AssemblyLoadingContext)).Length));
Microsoft.Build.Tasks.Core (1)
StringUtils.cs (1)
29Random random = new();
Microsoft.CodeAnalysis (1)
InternalUtilities\TextKeyedCache.cs (1)
238r = new Random();
Microsoft.CodeAnalysis.CSharp (2)
FlowAnalysis\NullableWalker.Variables.cs (1)
189_nextIdOffset = container?._nextIdOffset ?? new Random();
Utilities\ValueSetFactory.EnumeratedValueSet.cs (1)
66var candidates = _tc.RandomValues(_membersIncludedOrExcluded.Count + 1, new Random(0), _membersIncludedOrExcluded.Count + 1);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
SymbolKey\SymbolKeyTests.cs (1)
185var random = new Random(Seed: 0);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (3)
Semantics\PatternMatchingTests.cs (1)
4935Random r = new Random(dt);
Semantics\PatternMatchingTests_ListPatterns.cs (1)
7208var r = new Random();
Semantics\PatternMatchingTests3.cs (1)
4915Random random = new Random(seed);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (4)
SourceGeneration\AdditionalSourcesCollectionTests.cs (1)
138Random r = new Random();
SourceGeneration\GeneratorDriverFuzzTests.cs (1)
255var random = new Random();
Utilities\ValueSetTests.cs (2)
20private static readonly Random Random = new Random(); 592var Random = new Random(123445);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Source\CompletionTests.cs (1)
125Random r = new Random(t);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (4)
Parsing\PatternParsingTests.cs (1)
2983Random random = new Random();
Syntax\SyntaxAnnotationTests.cs (3)
474var randomGenerator = new Random(0); 511var randomGenerator = new Random(100); 767_random = new Random(10);
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
SpellCheck\SpellCheckTests.cs (1)
73var random = new Random(Seed: 0);
Microsoft.CodeAnalysis.Test.Utilities (1)
Syntax\SourceUtilities.cs (1)
18var random = new Random(12345);
Microsoft.CodeAnalysis.UnitTests (37)
CachingLookupTests.cs (2)
23private readonly Random _randomCaseGenerator = new Random(17); 27Random rand = new Random(seed);
Collections\BitArrayTests.cs (7)
39var r1 = new Random(seed); 40var r2 = new Random(seed); 68var r = new Random(seed); 106var r = new Random(seed); 157var r1 = new Random(seed); 158var r2 = new Random(seed); 192var r1 = new Random(seed);
Collections\GenericParameterHelper.cs (1)
19this.Data = new Random().Next();
Collections\HashSet\SegmentedHashSet_Generic_Tests.cs (10)
22Random rand = new Random(seed); 33Random rand = new Random(seed); 54Random rand = new Random(seed); 78Random rand = new Random(seed); 92Random rand = new Random(seed); 111Random rand = new Random(seed); 130Random rand = new Random(seed); 154Random rand = new Random(seed); 173Random rand = new Random(seed); 192Random rand = new Random(seed);
Collections\HashSet\SegmentedHashSet_IEnumerable_NonGeneric_Tests.cs (1)
59Random rand = new Random(seed);
Collections\ImmutableSegmentedListTest.cs (3)
47var random = new Random(seed); 189var random = new Random(randSeed); 218var random = new Random(randSeed);
Collections\ImmutablesTestBase.cs (1)
179var random = new Random(seed);
Collections\List\IList.NonGeneric.Tests.cs (2)
66Random rand = new Random(seed); 73Random rand = new Random(seed);
Collections\List\SegmentedList.Generic.cs (4)
23Random rand = new Random(seed); 34Random rand = new Random(seed); 44Random rand = new Random(seed); 71Random rand = new Random(seed);
Collections\List\SegmentedList.Generic.Tests.AsNonGenericIList.cs (2)
55Random rand = new Random(seed); 62Random rand = new Random(seed);
Collections\TopologicalSortTests.cs (2)
134Random random = new Random(seed); 202Random random = new Random(1893034696);
Text\SourceTextTests.cs (1)
242var random = new Random();
Text\TextChangeTests.cs (1)
985var random = new Random();
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (1)
src\Compilers\Core\Portable\InternalUtilities\TextKeyedCache.cs (1)
238r = new Random();
Microsoft.CodeAnalysis.Workspaces.UnitTests (6)
UtilityTest\SerializableBytesTests.cs (4)
80var random = new Random(0); 151var random = new Random(0); 166var random = new Random(0); 260var random = new Random(0);
WorkspaceServiceTests\TemporaryStorageServiceTests.cs (1)
245var random = new Random(Environment.TickCount);
XxHash128Tests.cs (1)
85var rand = new Random(42);
Microsoft.Data.Analysis (1)
DataFrame.cs (1)
346Random rand = new Random();
Microsoft.DotNet.Helix.Sdk (1)
AzureDevOpsTask.cs (1)
171private static readonly Random s_rand = new Random();
Microsoft.Extensions.AI.Abstractions.Tests (2)
Contents\DataContentTests.cs (1)
242Random rand = new(42);
Embeddings\BinaryEmbeddingTests.cs (1)
59Random r = new(42);
Microsoft.Extensions.AI.Tests (1)
ChatCompletion\FunctionInvokingChatClientTests.cs (1)
1021var value = new Random().Next(100);
Microsoft.Extensions.Caching.Hybrid (1)
Internal\HybridCachePayload.cs (1)
38private static readonly Random _entropySource = new(); // doesn't need to be cryptographic
Microsoft.Extensions.Caching.Hybrid.Tests (14)
DistributedCacheTests.cs (3)
71new Random().NextBytes(expected); 117new Random().NextBytes(expected); 279var rand = new Random();
PayloadTests.cs (10)
40new Random().NextBytes(bytes); 73new Random().NextBytes(bytes); 107new Random().NextBytes(bytes); 137new Random().NextBytes(bytes); 173new Random().NextBytes(bytes); 209new Random().NextBytes(bytes); 227new Random().NextBytes(bytes); 254new Random().NextBytes(bytes); 287new Random().NextBytes(bytes); 314new Random().NextBytes(bytes);
TagSetTests.cs (1)
157var rand = new Random();
Microsoft.Extensions.Caching.MicroBenchmarks (1)
DistributedCacheBenchmarks.cs (1)
20private readonly Random random = new Random();
Microsoft.Extensions.Http.Diagnostics.Tests (1)
Logging\Internal\RandomStringGenerator.cs (1)
11private static readonly Random _random = new();
Microsoft.Extensions.Options.Contextual.Tests (1)
AcceptanceTests.cs (1)
48private readonly Random _rng = new(0);
Microsoft.Extensions.TimeProvider.Testing.Tests (1)
TimerTests.cs (1)
333var random = new Random();
Microsoft.ML.AutoML (14)
API\BinaryClassificationExperiment.cs (2)
371_rnd = settings.Seed.HasValue ? new Random(settings.Seed.Value) : new Random();
API\MulticlassClassificationExperiment.cs (2)
357_rnd = settings.Seed.HasValue ? new Random(settings.Seed.Value) : new Random();
API\RegressionExperiment.cs (2)
377_rnd = settings.Seed.HasValue ? new Random(settings.Seed.Value) : new Random();
AutoMlUtils.cs (1)
15public static readonly ThreadLocal<Random> Random = new ThreadLocal<Random>(() => new Random());
Sweepers\SmacSweeper.cs (1)
292Random r = new Random();
Tuner\PipelineProposer.cs (2)
79_rand = new Random(settings.Seed.Value); 83_rand = new Random();
Tuner\SmacTuner.cs (2)
29private readonly Random _rnd = new Random(); 82_rnd = new Random(seed.Value);
Utils\RandomNumberGenerator.cs (2)
15_random = new Random(); 20_random = new Random(seed);
Microsoft.ML.AutoML.Samples (2)
AutoMLExperiment.cs (1)
89var random = new Random(seed);
Sweepable\SweepableLightGBMBinaryExperiment.cs (1)
116var random = new Random(seed);
Microsoft.ML.AutoML.Tests (1)
SweeperTests.cs (1)
150Random rand = new Random(0);
Microsoft.ML.Core (1)
Utilities\Random.cs (1)
47return new TauswortheHybrid(new Random());
Microsoft.ML.Core.Tests (1)
UnitTests\TestHosts.cs (1)
40Random rand = new Random();
Microsoft.ML.CpuMath.PerformanceTests (2)
PerformanceTests.cs (2)
59seed = new Random().Next(); 85Random rand = new Random(_seed);
Microsoft.ML.Data (1)
Prediction\Calibrator.cs (1)
1384_random = new System.Random(System.Threading.Interlocked.Increment(ref _randSeed) - 1);
Microsoft.ML.Fairlearn (1)
Reductions\Utilities.cs (1)
26var rand = new Random();
Microsoft.ML.FastTree (11)
BoostingFastTree.cs (1)
100optimizationAlgorithm.DropoutRng = new Random(FastTreeTrainerOptions.Seed);
Dataset\Dataset.cs (1)
582Random rnd = new Random(randomSeed);
FastTree.cs (1)
416_featureSelectionRandom = new Random(FastTreeTrainerOptions.FeatureSelectionSeed);
RandomForestRegression.cs (1)
549_rgen = new Random(0); // Ideally we'd get this from the host.
SumupPerformanceCommand.cs (1)
177Random r = new Random(salt + i);
Training\Applications\ObjectiveFunction.cs (1)
50_rnd = new Random(randomNumberGeneratorSeed);
Training\BaggingProvider.cs (1)
23RndGenerator = new Random(randomSeed);
Training\EnsembleCompression\LassoBasedEnsembleCompressor.cs (1)
63_rnd = new Random(randomSeed);
Training\OptimizationAlgorithms\OptimizationAlgorithm.cs (1)
46DropoutRng = new Random();
Training\ScoreTracker.cs (1)
89Random rndStart = new Random(rngSeed);
Training\TreeLearners\LeastSquaresRegressionTreeLearner.cs (1)
171Rand = new Random(randomSeed);
Microsoft.ML.GenAI.Mistral (1)
MistralCausalLMAgent.cs (1)
162var random = new Random();
Microsoft.ML.IntegrationTests (4)
Datasets\Iris.cs (1)
42var rng = new Random(seed);
Datasets\TypeTestData.cs (1)
111var rng = new Random(seed);
DataTransformation.cs (1)
220var rng = new Random(seed);
Prediction.cs (1)
87var rnd = new Random(1);
Microsoft.ML.PCA (2)
PcaTrainer.cs (1)
283var rng = new Random(seed);
PcaTransformer.cs (1)
309var rnd = columns[iinfo].Seed == null ? Host.Rand : new Random(columns[iinfo].Seed.Value);
Microsoft.ML.PerformanceTests (2)
BenchmarkBase.cs (1)
74Random random = new Random(1);
CacheDataViewBench.cs (1)
60var rand = new Random(0);
Microsoft.ML.Predictor.Tests (2)
TestTransposer.cs (2)
155Random rgen = new Random(0); 221Random rgen = new Random(1);
Microsoft.ML.Samples (96)
Dynamic\DataOperations\CrossValidationSplit.cs (1)
179var random = new Random(seed);
Dynamic\DataOperations\DataViewEnumerable.cs (1)
89var rng = new Random(1234321);
Dynamic\DataOperations\FilterRowsByColumn.cs (1)
89var rng = new Random(1234321);
Dynamic\DataOperations\LoadingSvmLight.cs (1)
15var random = new Random(42);
Dynamic\DataOperations\LoadingText.cs (1)
17var random = new Random(1);
Dynamic\DataOperations\ShuffleRows.cs (1)
77var rng = new Random(1234321);
Dynamic\DataOperations\SkipRows.cs (1)
81var rng = new Random(1234321);
Dynamic\DataOperations\TakeRows.cs (1)
82var rng = new Random(1234321);
Dynamic\DataOperations\TrainTestSplit.cs (1)
86var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\AveragedPerceptron.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\AveragedPerceptronWithOptions.cs (1)
99var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\FactorizationMachine.cs (1)
96var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\FastForest.cs (1)
91var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\FastForestWithOptions.cs (1)
103var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\FastTree.cs (1)
94var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\FastTreeWithOptions.cs (1)
106var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\FieldAwareFactorizationMachine.cs (1)
145var rnd = new Random(seed);
Dynamic\Trainers\BinaryClassification\FieldAwareFactorizationMachineWithOptions.cs (1)
156var rnd = new Random(seed);
Dynamic\Trainers\BinaryClassification\Gam.cs (1)
145var rng = new Random(seed);
Dynamic\Trainers\BinaryClassification\GamWithOptions.cs (1)
152var rng = new Random(seed);
Dynamic\Trainers\BinaryClassification\LbfgsLogisticRegression.cs (1)
91var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\LbfgsLogisticRegressionWithOptions.cs (1)
100var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\LdSvm.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\LdSvmWithOptions.cs (1)
97var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\LightGbm.cs (1)
91var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\LightGbmWithOptions.cs (1)
102var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\LinearSvm.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\LinearSvmWithOptions.cs (1)
97var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\PermutationFeatureImportance.cs (1)
100var rng = new Random(seed);
Dynamic\Trainers\BinaryClassification\PermutationFeatureImportanceLoadFromDisk.cs (1)
86var rng = new Random(seed);
Dynamic\Trainers\BinaryClassification\PriorTrainer.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SdcaLogisticRegression.cs (1)
96var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SdcaLogisticRegressionWithOptions.cs (1)
108var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SdcaNonCalibrated.cs (1)
95var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SdcaNonCalibratedWithOptions.cs (1)
110var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SgdCalibrated.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SgdCalibratedWithOptions.cs (1)
100var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SgdNonCalibrated.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SgdNonCalibratedWithOptions.cs (1)
97var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SymbolicSgdLogisticRegression.cs (1)
91var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SymbolicSgdLogisticRegressionWithOptions.cs (1)
100var random = new Random(seed);
Dynamic\Trainers\Clustering\KMeans.cs (1)
95var random = new Random(seed);
Dynamic\Trainers\Clustering\KMeansWithOptions.cs (1)
103var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\LbfgsMaximumEntropy.cs (1)
92var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\LbfgsMaximumEntropyWithOptions.cs (1)
100var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\LightGbm.cs (1)
95var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\LightGbmWithOptions.cs (1)
105var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\LogLossPerClass.cs (1)
75var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\NaiveBayes.cs (1)
100var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\OneVersusAll.cs (1)
93var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\PairwiseCoupling.cs (1)
93var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\PermutationFeatureImportance.cs (1)
104var rng = new Random(seed);
Dynamic\Trainers\MulticlassClassification\PermutationFeatureImportanceLoadFromDisk.cs (1)
113var rng = new Random(seed);
Dynamic\Trainers\MulticlassClassification\SdcaMaximumEntropy.cs (1)
99var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\SdcaMaximumEntropyWithOptions.cs (1)
109var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\SdcaNonCalibrated.cs (1)
100var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\SdcaNonCalibratedWithOptions.cs (1)
109var random = new Random(seed);
Dynamic\Trainers\Ranking\FastTree.cs (1)
74var random = new Random(seed);
Dynamic\Trainers\Ranking\FastTreeWithOptions.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\Ranking\LightGbm.cs (1)
74var random = new Random(seed);
Dynamic\Trainers\Ranking\LightGbmWithOptions.cs (1)
89var random = new Random(seed);
Dynamic\Trainers\Ranking\PermutationFeatureImportance.cs (1)
114var rng = new Random(seed);
Dynamic\Trainers\Ranking\PermutationFeatureImportanceLoadFromDisk.cs (1)
121var rng = new Random(seed);
Dynamic\Trainers\Regression\FastForest.cs (1)
75var random = new Random(seed);
Dynamic\Trainers\Regression\FastForestWithOptions.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\Regression\FastTree.cs (1)
75var random = new Random(seed);
Dynamic\Trainers\Regression\FastTreeTweedie.cs (1)
75var random = new Random(seed);
Dynamic\Trainers\Regression\FastTreeTweedieWithOptions.cs (1)
90var random = new Random(seed);
Dynamic\Trainers\Regression\FastTreeWithOptions.cs (1)
91var random = new Random(seed);
Dynamic\Trainers\Regression\Gam.cs (1)
75var random = new Random(seed);
Dynamic\Trainers\Regression\GamAdvanced.cs (1)
143var rng = new Random(seed);
Dynamic\Trainers\Regression\GamWithOptions.cs (1)
86var random = new Random(seed);
Dynamic\Trainers\Regression\GamWithOptionsAdvanced.cs (1)
151var rng = new Random(seed);
Dynamic\Trainers\Regression\LbfgsPoissonRegression.cs (1)
73var random = new Random(seed);
Dynamic\Trainers\Regression\LbfgsPoissonRegressionWithOptions.cs (1)
87var random = new Random(seed);
Dynamic\Trainers\Regression\LightGbm.cs (1)
76var random = new Random(seed);
Dynamic\Trainers\Regression\LightGbmWithOptions.cs (1)
95var random = new Random(seed);
Dynamic\Trainers\Regression\OnlineGradientDescent.cs (1)
64var random = new Random(seed);
Dynamic\Trainers\Regression\OnlineGradientDescentWithOptions.cs (1)
80var random = new Random(seed);
Dynamic\Trainers\Regression\OrdinaryLeastSquares.cs (1)
72var random = new Random(seed);
Dynamic\Trainers\Regression\OrdinaryLeastSquaresWithOptions.cs (1)
84var random = new Random(seed);
Dynamic\Trainers\Regression\PermutationFeatureImportance.cs (1)
110var rng = new Random(seed);
Dynamic\Trainers\Regression\PermutationFeatureImportanceLoadFromDisk.cs (1)
117var rng = new Random(seed);
Dynamic\Trainers\Regression\Sdca.cs (1)
72var random = new Random(seed);
Dynamic\Trainers\Regression\SdcaWithOptions.cs (1)
88var random = new Random(seed);
Dynamic\Transforms\CalculateFeatureContribution.cs (1)
119var rng = new Random(seed);
Dynamic\Transforms\CalculateFeatureContributionCalibrated.cs (1)
126var rng = new Random(seed);
Dynamic\Transforms\Conversion\MapKeyToValueMultiColumn.cs (1)
91var rnd = new Random(0);
Dynamic\Transforms\ImageAnalytics\ConvertToImage.cs (1)
97var random = new Random(seed);
Dynamic\Transforms\TreeFeaturization\FastForestBinaryFeaturizationWithOptions.cs (1)
125var random = new Random(seed);
Dynamic\Transforms\TreeFeaturization\FastForestRegressionFeaturizationWithOptions.cs (1)
126var random = new Random(seed);
Dynamic\Transforms\TreeFeaturization\FastTreeBinaryFeaturizationWithOptions.cs (1)
127var random = new Random(seed);
Dynamic\Transforms\TreeFeaturization\FastTreeRankingFeaturizationWithOptions.cs (1)
123var random = new Random(seed);
Dynamic\Transforms\TreeFeaturization\FastTreeRegressionFeaturizationWithOptions.cs (1)
126var random = new Random(seed);
Dynamic\Transforms\TreeFeaturization\FastTreeTweedieFeaturizationWithOptions.cs (1)
126var random = new Random(seed);
Dynamic\Transforms\TreeFeaturization\PretrainedTreeEnsembleFeaturizationWithOptions.cs (1)
134var random = new Random(seed);
Microsoft.ML.SamplesUtils (4)
SamplesDatasetUtils.cs (4)
246var rnd = new Random(0); 295var rnd = new Random(0); 309var rnd = new Random(0); 365var rnd = new Random(0);
Microsoft.ML.SearchSpace (3)
Tuner\RandomTuner.cs (3)
18_rnd = new Random(seed.Value); 22_rnd = new Random(); 28_rnd = new Random(seed);
Microsoft.ML.StandardTrainers (3)
Optimizer\DifferentiableFunction.cs (3)
163private static readonly Random _r = new Random(5); 260Random r = new Random(5); 299Random r = new Random(5);
Microsoft.ML.Sweeper (3)
Algorithms\KdoSweeper.cs (1)
260Random rng = new Random();
Algorithms\SmacSweeper.cs (1)
301Random r = new Random();
Algorithms\SweeperProbabilityUtils.cs (1)
18_rng = new Random(host.Rand.Next());
Microsoft.ML.Sweeper.Tests (9)
TestSweeper.cs (9)
69var random = new Random(123); 132var random = new Random(42); 182var random = new Random(42); 232var random = new Random(42); 300var random = new Random(42); 352var random = new Random(42); 540var random = new Random(42); 596var random = new Random(42); 644var random = new Random(42);
Microsoft.ML.TestFramework (2)
DataPipe\TestDataPipe.cs (1)
1169Random rgen = new Random(0);
DataPipe\TestDataPipeBase.cs (1)
266using (var c1 = newPipe.GetRowCursor(newPipe.Schema, new Random(123)))
Microsoft.ML.Tests (15)
CalibratedModelParametersTests.cs (1)
99var rand = new Random(10);
FeatureContributionTests.cs (1)
260var rand = new Random(10);
ImagesTests.cs (1)
1103var random = new Random(seed);
PermutationFeatureImportanceTests.cs (2)
817var rand = new Random(10); 884var rand = new Random(10);
Scenarios\Api\CookbookSamples\CookbookSamplesDynamicApi.cs (1)
487var r = new Random(454);
Scenarios\ClusteringTests.cs (1)
34var rand = new Random(1);
TrainerEstimators\FAFMEstimator.cs (1)
124var rnd = new Random(0);
TrainerEstimators\TreeEstimators.cs (1)
727var random = new Random(seed);
Transformers\LineParserTests.cs (1)
56Random rand = new Random();
Transformers\NormalizerTests.cs (3)
1111var rand = new Random(seed); 1182Random rand = new Random(0); 1256Random rand = new Random(0);
Transformers\RffTests.cs (2)
45Random rand = new Random(); 93Random rand = new Random();
Microsoft.ML.Tokenizers (1)
Model\Word.cs (1)
118if (dropout.HasValue && (_random ??= new()).NextDouble() < dropout)
Microsoft.ML.Transforms (2)
Dracula\CountTableTransformer.cs (2)
686var rand = _addNoise ? new Random(_parent.Seeds[iinfo]) : null; 706var rand = _addNoise ? new Random(_parent.Seeds[iinfo]) : null;
Microsoft.VisualBasic.Tests (1)
Microsoft\VisualBasic\ApplicationServices\SingleInstanceTests.cs (1)
184Random r = new();
MilvusPlayground.ApiService (1)
Program.cs (1)
45Random ran = new();
PresentationFramework (1)
System\Windows\Documents\FixedPageStructure.cs (1)
448Random random = new Random();
Roslyn.VisualStudio.Next.UnitTests (1)
Services\VisualStudioDiagnosticAnalyzerExecutorTests.cs (1)
126var random = new Random(Environment.TickCount);
ScenarioTests.Common.Tests (2)
ScenarioTestHelpers.cs (1)
231Random rand = new Random(seed);
ScenarioTestTypes.cs (1)
1139Random rand = new Random(seed);
Shared.Tests (1)
Pools\PoolTests.cs (1)
266var r = new Random(seed);
System.Data.Odbc (1)
Common\System\Data\ProviderBase\DbConnectionPool.cs (1)
96private static readonly Random s_random = new Random(5101977); // Value obtained from Dave Driver
System.ServiceModel.NetNamedPipe (1)
System\Runtime\BackoffTimeoutHelper.cs (1)
31_random = new Random(GetHashCode());
System.Text.RegularExpressions (3)
System\Text\RegularExpressions\Regex.Cache.cs (1)
57private static readonly Random s_random = new Random();
System\Text\RegularExpressions\Symbolic\SymbolicRegexMatcher.Sample.cs (2)
38Random random = randomseed != 0 ? new Random(randomseed) : new Random();
System.Text.RegularExpressions.Generator (1)
RegexGenerator.Emitter.cs (1)
1500Random stackCookieGenerator = new(12345); // seed for deterministic behavior
System.Windows.Forms.Tests (6)
System\Windows\Forms\ApplicationTests.cs (1)
579Random rnd = new Random();
System\Windows\Forms\ComboBoxTests.cs (2)
2428Random random = new(DateTime.Now.Millisecond); 2483Random random = new();
System\Windows\Forms\FontCacheTests.cs (1)
22Random random = new();
System\Windows\Forms\ListViewGroupTests.cs (1)
250Random random = new();
System\Windows\Forms\ScreenDcCacheTests.cs (1)
13Random random = new();
TestReferenceAssembly (6)
OtherDllClass.cs (4)
41Random r = new Random(); 73Random r = new Random(); 102Random r = new Random(); 131Random r = new Random();
OtherDllStaticMethods.cs (2)
37Random r = new Random(); 75Random r = new Random();
Wasm.Performance.TestApp (1)
Person.cs (1)
20var rng = new Random(0);
WinFormsControlsTest (2)
ListViewTest.cs (2)
18Random random = new(); 227Random random = new();
756 references to Random
Aspire.Dashboard.Tests (3)
Integration\MockOpenIdAuthority.cs (1)
73lastCode = Random.Shared.Next().ToString(CultureInfo.InvariantCulture);
Integration\ServerRetryHelper.cs (2)
31var nextPortAttempt = 30000 + Random.Shared.Next(10000); 42nextPortAttempt = port + Random.Shared.Next(100);
BlazorServerApp (2)
Data\WeatherForecastService.cs (2)
18TemperatureC = Random.Shared.Next(-20, 55), 19Summary = Summaries[Random.Shared.Next(Summaries.Length)]
BlazorUnitedApp (2)
Data\WeatherForecastService.cs (2)
18TemperatureC = Random.Shared.Next(-20, 55), 19Summary = Summaries[Random.Shared.Next(Summaries.Length)]
CustomResources.AppHost (3)
TestResource.cs (3)
45var seconds = Random.Shared.Next(2, 12); 58var randomState = states[Random.Shared.Next(0, states.Length)]; 59var randomStyle = stateStyles[Random.Shared.Next(0, stateStyles.Length)];
HeaderPropagationSample (1)
Startup.cs (1)
113if (Random.Shared.NextDouble() > threshold)
HostedBlazorWebassemblyApp.Server (2)
Data\WeatherForecastService.cs (2)
24TemperatureC = Random.Shared.Next(-20, 55), 25Summary = Summaries[Random.Shared.Next(Summaries.Length)]
HttpStress (2)
Program.cs (2)
66seed: cmdline.ValueForOption<int?>("-seed") ?? Random.Shared.Next()); 632private readonly Random _random;
IdeBenchmarks (1)
SQLitePersistentStorageBenchmark.cs (1)
33private Random _random;
IIS.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\AspNetCorePortTests.cs (1)
159var port = Random.Shared.Next(_minPort, _maxPort);
src\Servers\IIS\IIS\test\Common.FunctionalTests\RequestResponseTests.cs (1)
733var disconnectAfter = Random.Shared.Next(maxRequestSize);
IISExpress.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\AspNetCorePortTests.cs (1)
159var port = Random.Shared.Next(_minPort, _maxPort);
src\Servers\IIS\IIS\test\Common.FunctionalTests\RequestResponseTests.cs (1)
733var disconnectAfter = Random.Shared.Next(maxRequestSize);
InMemory.FunctionalTests (2)
src\Servers\Kestrel\shared\test\ServerRetryHelper.cs (2)
22var nextPortAttempt = 30000 + Random.Shared.Next(10000); 37nextPortAttempt = port + Random.Shared.Next(100);
Interop.FunctionalTests (2)
src\Servers\Kestrel\shared\test\ServerRetryHelper.cs (2)
22var nextPortAttempt = 30000 + Random.Shared.Next(10000); 37nextPortAttempt = port + Random.Shared.Next(100);
JwtClientSample (1)
Program.cs (1)
72nextMsgAt = Random.Shared.Next(2, 5);
Keycloak.ApiService (2)
Program.cs (2)
34Random.Shared.Next(-20, 55), 35summaries[Random.Shared.Next(summaries.Length)]
KeyManagementSimulator (9)
Program.cs (9)
85seed = Random.Shared.Next(); 93var productRandom = new Random(seed); 94var simulatorRandom = new Random(productRandom.Next()); 326public AppInstance(int instanceNumber, IXmlEncryptor encryptor, IXmlDecryptor decryptor, IXmlRepository repository, Random productRandom) 471private readonly Random _random; 483public FlakyObject(Random random, double pFail) 520sealed class FlakyXmlRepository(Random random, double pFail) : FlakyObject(random, pFail), IXmlRepository 551sealed class FlakyXmlEncryptor(Random random, double pFail) : FlakyObject(random, pFail), IXmlEncryptor 570sealed class FlakyXmlDecryptor(Random random, double pFail) : FlakyObject(random, pFail), IXmlDecryptor
Microsoft.Arcade.Common (1)
ExponentialRetry.cs (1)
13private Random _random = new Random();
Microsoft.AspNetCore.Components.Server.Tests (2)
Circuits\RemoteJSDataStreamTest.cs (2)
52var random = new Random(); 80var random = new Random();
Microsoft.AspNetCore.DataProtection (2)
KeyManagement\KeyRingProvider.cs (2)
65JitterRandom = Random.Shared; 72internal Random JitterRandom { get; set; }
Microsoft.AspNetCore.Identity.Specification.Tests (2)
UserManagerSpecificationTests.cs (2)
304var email = "foo" + Random.Shared.Next() + "@example.com"; 305var newEmail = "bar" + Random.Shared.Next() + "@example.com";
Microsoft.AspNetCore.InternalTesting.Tests (2)
HttpClientSlimTest.cs (2)
72var random = Random.Shared;
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (1)
EndpointMetadataApiDescriptionProviderTest.cs (1)
504return Random.Shared.Next() % 2 == 0
Microsoft.AspNetCore.OpenApi.Tests (1)
Services\OpenApiSchemaService\OpenApiSchemaService.ResponseSchemas.cs (1)
173static Todo? GetTodo() => Random.Shared.Next() < 0.5 ? new Todo(1, "Test Title", true, DateTime.Now) : null;
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (7)
EndToEndBenchmarks.cs (7)
53Random.Shared.NextBytes(_payloadOversized); 80var rand = Random.Shared; 93var rand = Random.Shared; 108var rand = Random.Shared;
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (1)
RedisOutputCacheStore.cs (1)
98var secondsWithJitter = 300 + Random.Shared.Next(-30, 30);
Microsoft.AspNetCore.Routing.Tests (1)
RouteCollectionTest.cs (1)
508int index = Random.Shared.Next(0, routeNames.Length - 1);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (4)
KestrelServerTests.cs (2)
999? Random.Shared.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort) 1051? Random.Shared.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)
src\Servers\Kestrel\shared\test\ServerRetryHelper.cs (2)
22var nextPortAttempt = 30000 + Random.Shared.Next(10000); 37nextPortAttempt = port + Random.Shared.Next(100);
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (2)
src\Servers\Kestrel\shared\test\ServerRetryHelper.cs (2)
22var nextPortAttempt = 30000 + Random.Shared.Next(10000); 37nextPortAttempt = port + Random.Shared.Next(100);
Microsoft.AspNetCore.SignalR.Common.Tests (1)
Internal\Protocol\MemoryBufferWriterTests.cs (1)
406Random.Shared.NextBytes(data);
Microsoft.AspNetCore.SignalR.Microbenchmarks (2)
MessageParserBenchmark.cs (2)
25Random.Shared.NextBytes(buffer); 39Random.Shared.NextBytes(buffer);
Microsoft.AspNetCore.SignalR.Tests (1)
Internal\MessageBufferTests.cs (1)
311var ackNum = Random.Shared.Next(0, 1000);
Microsoft.AspNetCore.WebSockets.Tests (1)
WebSocketCompressionMiddlewareTests.cs (1)
146Random.Shared.NextBytes(clientBuf);
Microsoft.Build (1)
StringUtils.cs (1)
29Random random = new();
Microsoft.Build.Framework (1)
Telemetry\OpenTelemetryManager.cs (1)
233Random random = new();
Microsoft.Build.Tasks.Core (1)
StringUtils.cs (1)
29Random random = new();
Microsoft.CodeAnalysis (4)
DiagnosticAnalyzer\AnalyzerFileReference.cs (2)
653var random = 655Random.Shared;
InternalUtilities\TextKeyedCache.cs (2)
65private Random? _random; 232var r = _random;
Microsoft.CodeAnalysis.CSharp (36)
FlowAnalysis\NullableWalker.Variables.cs (1)
99private readonly Random _nextIdOffset;
Utilities\IValueSetFactory.cs (2)
28IValueSet Random(int expectedSize, Random random); 33ConstantValue RandomValue(Random random);
Utilities\ValueSetFactory.BoolValueSetFactory.cs (2)
42IValueSet IValueSetFactory.Random(int expectedSize, Random random) => random.Next(4) switch 51ConstantValue IValueSetFactory.RandomValue(Random random) => ConstantValue.Create(random.NextDouble() < 0.5);
Utilities\ValueSetFactory.ByteTC.cs (1)
61byte INumericTC<byte>.Random(Random random)
Utilities\ValueSetFactory.CharTC.cs (1)
62char INumericTC<char>.Random(Random random)
Utilities\ValueSetFactory.DecimalTC.cs (1)
115public decimal Random(Random random)
Utilities\ValueSetFactory.DecimalValueSetFactory.cs (2)
23IValueSet IValueSetFactory.Random(int expectedSize, Random random) => _underlying.Random(expectedSize, random); 25ConstantValue IValueSetFactory.RandomValue(Random random) => ConstantValue.Create(DecimalTC.Instance.Random(random));
Utilities\ValueSetFactory.DoubleTC.cs (1)
101double INumericTC<double>.Random(Random random)
Utilities\ValueSetFactory.EnumeratedValueSetFactory.cs (2)
47public IValueSet Random(int expectedSize, Random random) 58ConstantValue IValueSetFactory.RandomValue(Random random)
Utilities\ValueSetFactory.FloatingValueSet.cs (1)
38internal static IValueSet<TFloating> Random(int expectedSize, Random random, FloatingTC<TFloating> tc)
Utilities\ValueSetFactory.FloatingValueSetFactory.cs (2)
27IValueSet IValueSetFactory.Random(int expectedSize, Random random) => 30ConstantValue IValueSetFactory.RandomValue(Random random)
Utilities\ValueSetFactory.IEqualableValueTC.cs (1)
35T[] RandomValues(int count, Random random, int scope = 0);
Utilities\ValueSetFactory.IntTC.cs (1)
71public int Random(Random random)
Utilities\ValueSetFactory.INumericTC.cs (1)
58T Random(Random random);
Utilities\ValueSetFactory.LongTC.cs (1)
61long INumericTC<long>.Random(Random random)
Utilities\ValueSetFactory.NintValueSetFactory.cs (2)
32IValueSet IValueSetFactory.Random(int expectedSize, Random random) 41ConstantValue IValueSetFactory.RandomValue(Random random) => ConstantValue.CreateNativeInt(IntTC.DefaultInstance.Random(random));
Utilities\ValueSetFactory.NonNegativeIntValueSetFactory.cs (2)
53IValueSet IValueSetFactory.Random(int expectedSize, Random random) => s_underlying.Random(expectedSize, random); 55ConstantValue IValueSetFactory.RandomValue(Random random) => s_underlying.RandomValue(random);
Utilities\ValueSetFactory.NuintValueSetFactory.cs (2)
31IValueSet IValueSetFactory.Random(int expectedSize, Random random) 39ConstantValue IValueSetFactory.RandomValue(Random random) => ConstantValue.CreateNativeUInt(UIntTC.Instance.Random(random));
Utilities\ValueSetFactory.NumericValueSet.cs (1)
293internal static IValueSet<T> Random(int expectedSize, Random random, INumericTC<T> tc)
Utilities\ValueSetFactory.NumericValueSetFactory.cs (2)
55public IValueSet Random(int expectedSize, Random random) => 58ConstantValue IValueSetFactory.RandomValue(Random random)
Utilities\ValueSetFactory.SByteTC.cs (1)
60sbyte INumericTC<sbyte>.Random(Random random)
Utilities\ValueSetFactory.ShortTC.cs (1)
61short INumericTC<short>.Random(Random random)
Utilities\ValueSetFactory.SingleTC.cs (1)
105float INumericTC<float>.Random(Random random)
Utilities\ValueSetFactory.StringTC.cs (1)
24string[] IEquatableValueTC<string>.RandomValues(int count, Random random, int scope)
Utilities\ValueSetFactory.UIntTC.cs (1)
61public uint Random(Random random)
Utilities\ValueSetFactory.ULongTC.cs (1)
61ulong INumericTC<ulong>.Random(Random random)
Utilities\ValueSetFactory.UShortTC.cs (1)
61ushort INumericTC<ushort>.Random(Random random)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
SymbolKey\SymbolKeyTests.cs (1)
185var random = new Random(Seed: 0);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (3)
Semantics\PatternMatchingTests.cs (1)
4935Random r = new Random(dt);
Semantics\PatternMatchingTests_ListPatterns.cs (1)
7208var r = new Random();
Semantics\PatternMatchingTests3.cs (1)
4915Random random = new Random(seed);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (5)
SourceGeneration\AdditionalSourcesCollectionTests.cs (1)
138Random r = new Random();
SourceGeneration\GeneratorDriverFuzzTests.cs (2)
255var random = new Random(); 262private void Fuzz_Iteration(int iteration, Random random)
Utilities\ValueSetTests.cs (2)
20private static readonly Random Random = new Random(); 592var Random = new Random(123445);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Source\CompletionTests.cs (1)
125Random r = new Random(t);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (4)
Parsing\PatternParsingTests.cs (1)
2983Random random = new Random();
Syntax\SyntaxAnnotationTests.cs (3)
474var randomGenerator = new Random(0); 511var randomGenerator = new Random(100); 761private readonly Random _random;
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
SpellCheck\SpellCheckTests.cs (1)
73var random = new Random(Seed: 0);
Microsoft.CodeAnalysis.Test.Utilities (1)
Syntax\SourceUtilities.cs (1)
18var random = new Random(12345);
Microsoft.CodeAnalysis.UnitTests (43)
CachingLookupTests.cs (2)
23private readonly Random _randomCaseGenerator = new Random(17); 27Random rand = new Random(seed);
Collections\BitArrayTests.cs (14)
39var r1 = new Random(seed); 40var r2 = new Random(seed); 53private void CheckRandomDataCore(Random r1, Random r2, int capacity) 68var r = new Random(seed); 77private void CheckIntersectionCore(int capacity, Random r) 106var r = new Random(seed); 118private void CheckUnionCore(int capacity1, int capacity2, Random r) 157var r1 = new Random(seed); 158var r2 = new Random(seed); 192var r1 = new Random(seed); 232private void CheckTrueBitsCore(int capacity, Random r1, Random r2) 327public static bool NextBool(this Random self)
Collections\HashSet\SegmentedHashSet_Generic_Tests.cs (10)
22Random rand = new Random(seed); 33Random rand = new Random(seed); 54Random rand = new Random(seed); 78Random rand = new Random(seed); 92Random rand = new Random(seed); 111Random rand = new Random(seed); 130Random rand = new Random(seed); 154Random rand = new Random(seed); 173Random rand = new Random(seed); 192Random rand = new Random(seed);
Collections\HashSet\SegmentedHashSet_IEnumerable_NonGeneric_Tests.cs (1)
59Random rand = new Random(seed);
Collections\ImmutableSegmentedListTest.cs (3)
47var random = new Random(seed); 189var random = new Random(randSeed); 218var random = new Random(randSeed);
Collections\ImmutablesTestBase.cs (1)
179var random = new Random(seed);
Collections\List\IList.NonGeneric.Tests.cs (2)
66Random rand = new Random(seed); 73Random rand = new Random(seed);
Collections\List\SegmentedList.Generic.cs (4)
23Random rand = new Random(seed); 34Random rand = new Random(seed); 44Random rand = new Random(seed); 71Random rand = new Random(seed);
Collections\List\SegmentedList.Generic.Tests.AsNonGenericIList.cs (2)
55Random rand = new Random(seed); 62Random rand = new Random(seed);
Collections\TopologicalSortTests.cs (2)
134Random random = new Random(seed); 202Random random = new Random(1893034696);
Text\SourceTextTests.cs (1)
242var random = new Random();
Text\TextChangeTests.cs (1)
985var random = new Random();
Microsoft.CodeAnalysis.Workspaces (2)
Diagnostics\HostDiagnosticAnalyzers.cs (2)
241var random = 243Random.Shared;
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (2)
src\Compilers\Core\Portable\InternalUtilities\TextKeyedCache.cs (2)
65private Random? _random; 232var r = _random;
Microsoft.CodeAnalysis.Workspaces.UnitTests (6)
UtilityTest\SerializableBytesTests.cs (4)
80var random = new Random(0); 151var random = new Random(0); 166var random = new Random(0); 260var random = new Random(0);
WorkspaceServiceTests\TemporaryStorageServiceTests.cs (1)
245var random = new Random(Environment.TickCount);
XxHash128Tests.cs (1)
85var rand = new Random(42);
Microsoft.Data.Analysis (3)
DataFrame.cs (1)
346Random rand = new Random();
DataFrame.IDataView.cs (2)
57DataViewRowCursor IDataView.GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand) 62DataViewRowCursor[] IDataView.GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand)
Microsoft.DotNet.Helix.Sdk (1)
AzureDevOpsTask.cs (1)
171private static readonly Random s_rand = new Random();
Microsoft.Extensions.AI.Abstractions.Tests (2)
Contents\DataContentTests.cs (1)
242Random rand = new(42);
Embeddings\BinaryEmbeddingTests.cs (1)
59Random r = new(42);
Microsoft.Extensions.Caching.Hybrid (1)
Internal\HybridCachePayload.cs (1)
38private static readonly Random _entropySource = new(); // doesn't need to be cryptographic
Microsoft.Extensions.Caching.Hybrid.Tests (4)
DistributedCacheTests.cs (3)
279var rand = new Random(); 356public CustomSegment(int size, Random? rand, CustomSegment? previous) 372public CustomMemory(int size, Random? rand = null)
TagSetTests.cs (1)
157var rand = new Random();
Microsoft.Extensions.Caching.MicroBenchmarks (1)
DistributedCacheBenchmarks.cs (1)
20private readonly Random random = new Random();
Microsoft.Extensions.Http.Diagnostics.Tests (1)
Logging\Internal\RandomStringGenerator.cs (1)
11private static readonly Random _random = new();
Microsoft.Extensions.Http.Resilience (2)
Internal\Randomizer.cs (2)
14public virtual double NextDouble(double maxValue) => Random.Shared.NextDouble() * maxValue; 16public virtual int NextInt(int maxValue) => Random.Shared.Next(maxValue);
Microsoft.Extensions.ObjectPool.Microbenchmark (1)
Foo.cs (1)
19LastRandom = Random.Shared.Next();
Microsoft.Extensions.Options.Contextual.Tests (1)
AcceptanceTests.cs (1)
48private readonly Random _rng = new(0);
Microsoft.Extensions.TimeProvider.Testing.Tests (1)
TimerTests.cs (1)
333var random = new Random();
Microsoft.JSInterop.Tests (1)
JSRuntimeTest.cs (1)
345Random.Shared.NextBytes(byteArray);
Microsoft.ML.AutoML (10)
API\BinaryClassificationExperiment.cs (1)
363private readonly Random _rnd;
API\MulticlassClassificationExperiment.cs (1)
348private readonly Random _rnd;
API\RegressionExperiment.cs (1)
368private readonly Random _rnd;
AutoMlUtils.cs (2)
15public static readonly ThreadLocal<Random> Random = new ThreadLocal<Random>(() => new Random());
Experiment\Experiment.cs (1)
38private Random _newContextSeedGenerator;
Sweepers\SmacSweeper.cs (1)
292Random r = new Random();
Tuner\PipelineProposer.cs (1)
41private readonly Random _rand;
Tuner\SmacTuner.cs (1)
29private readonly Random _rnd = new Random();
Utils\RandomNumberGenerator.cs (1)
11private readonly Random _random;
Microsoft.ML.AutoML.Samples (2)
AutoMLExperiment.cs (1)
89var random = new Random(seed);
Sweepable\SweepableLightGBMBinaryExperiment.cs (1)
116var random = new Random(seed);
Microsoft.ML.AutoML.Tests (1)
SweeperTests.cs (1)
150Random rand = new Random(0);
Microsoft.ML.Core (35)
Data\IHostEnvironment.cs (1)
131Random Rand { get; }
Environment\ConsoleEnvironment.cs (3)
394protected override IHost RegisterCore(HostEnvironmentBase<ConsoleEnvironment> source, string shortName, string parentFullName, Random rand, bool verbose) 465public Host(HostEnvironmentBase<ConsoleEnvironment> source, string shortName, string parentFullName, Random rand, bool verbose) 487protected override IHost RegisterCore(HostEnvironmentBase<ConsoleEnvironment> source, string shortName, string parentFullName, Random rand, bool verbose)
Environment\HostEnvironmentBase.cs (7)
122public Random Rand => _rand; 124public HostBase(HostEnvironmentBase<TEnv> source, string shortName, string parentFullName, Random rand, bool verbose) 142Random rand = (seed.HasValue) ? RandomUtils.Create(seed.Value) : RandomUtils.Create(_rand); 350private readonly Random _rand; 388protected HostEnvironmentBase(HostEnvironmentBase<TEnv> source, Random rand, bool verbose, 421Random rand = (seed.HasValue) ? RandomUtils.Create(seed.Value) : RandomUtils.Create(_rand); 436string parentFullName, Random rand, bool verbose);
Utilities\Random.cs (6)
15public static float NextSingle(this Random random) 32public static int NextSigned(this Random random) 76public static TauswortheHybrid Create(Random seed) 142public TauswortheHybrid(Random rng) 150private static uint GetU(Random rng) 155private static uint GetSeed(Random rng)
Utilities\ReservoirSampler.cs (4)
59private readonly Random _rnd; 70public ReservoirSamplerWithoutReplacement(Random rnd, int size, ValueGetter<T> getter) 138private readonly Random _rnd; 149public ReservoirSamplerWithReplacement(Random rnd, int size, ValueGetter<T> getter)
Utilities\Stats.cs (12)
22public static long SampleLong(long rangeSize, Random rand) 53public static double SampleFromGaussian(Random rand) 77public static double SampleFromGamma(Random r, double alpha) 113public static double SampleFromBeta(Random rand, double alpha1, double alpha2) 126public static void SampleFromDirichlet(Random rand, double[] alphas, double[] result) 143public static int SampleFromPoisson(Random rand, double lambda) 203public static float SampleFromLaplacian(Random rand, float mean, float scale) 222public static float SampleFromCauchy(Random rand) 235public static int SampleFromBinomial(Random r, int n, double p) 268public static int Next(Random rand, int n, double p) 286private static int InvTransform(int n, double p, Random rn) 310private static int GenerateLarge(int n, double p, Random rn)
Utilities\Utils.cs (2)
501public static int[] GetRandomPermutation(Random rand, int size) 545public static void Shuffle<T>(Random rand, Span<T> rgv)
Microsoft.ML.Core.Tests (6)
UnitTests\TestHosts.cs (1)
40Random rand = new Random();
UnitTests\TestVBuffer.cs (5)
951private static float ScaleFactor(int trial, Random rgen) 966private static void GenerateSingle(Random rgen, int len, out VBuffer<float> a) 972private static void GenerateVBuffer(Random rgen, int len, int count, out VBuffer<float> dst) 994private static void FillRandomIndices(Random rgen, int[] indices, int len, int count) 1087private static void GeneratePair(Random rgen, int len, out VBuffer<float> a, out VBuffer<float> b, out GenLogic subcase)
Microsoft.ML.CpuMath.PerformanceTests (2)
PerformanceTests.cs (2)
41private float NextFloat(Random rand, int expRange) 85Random rand = new Random(_seed);
Microsoft.ML.Data (115)
Data\DataViewUtils.cs (1)
114IDataView view, IEnumerable<DataViewSchema.Column> columnsNeeded, IHost host, Random rand)
Data\RowCursorUtils.cs (2)
525public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnNeeded, Random rand = null) 532public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnNeeded, int n, Random rand = null)
DataLoadSave\Binary\BinaryLoader.cs (5)
1189private DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 1195var ourRand = _randomShufflePoolRows == _header.RowCount ? null : rand; 1202public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 1208public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 1246public Cursor(BinaryLoader parent, IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand)
DataLoadSave\Binary\BinarySaver.cs (1)
740Random rand = data.CanShuffle ? new TauswortheHybrid(_host.Rand) : null;
DataLoadSave\Database\DatabaseLoader.cs (2)
720public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 727public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
DataLoadSave\LegacyCompositeDataLoader.cs (2)
585public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 593public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
DataLoadSave\Text\TextLoader.cs (2)
1662public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 1669public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
DataLoadSave\Transpose\TransposeLoader.cs (2)
622public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 630public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
DataView\AppendRowsDataView.cs (6)
147public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 154public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 309private readonly Random _rand; 313public RandCursor(AppendRowsDataView parent, IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand, int[] counts) 409private readonly Random _rand; 417public MultinomialWithoutReplacementSampler(IExceptionContext context, int[] counts, Random rand)
DataView\ArrayDataViewBuilder.cs (3)
235public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 243public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 265public Cursor(IChannelProvider provider, DataView view, Func<int, bool> predicate, Random rand)
DataView\BatchDataViewMapperBase.cs (2)
30public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 58public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
DataView\CacheDataView.cs (5)
209public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 229private int[] GetPermutationOrNull(Random rand) 243private DataViewRowCursor GetRowCursorWaiterCore<TWaiter>(TWaiter waiter, Func<int, bool> predicate, Random rand) 255public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 272private DataViewRowCursor[] GetRowCursorSetWaiterCore<TWaiter>(TWaiter waiter, Func<int, bool> predicate, int n, Random rand)
DataView\DataViewConstructionUtils.cs (6)
484public abstract DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null); 486public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 620public override DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 637Func<int, bool> predicate, Random rand) 703public override DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 772public override DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null)
DataView\EmptyDataView.cs (2)
33public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 39public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
DataView\LambdaFilter.cs (2)
111protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 124public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
DataView\OpaqueDataView.cs (2)
28public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 31public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
DataView\RowToRowMapperTransform.cs (2)
189protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 197public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
DataView\Transposer.cs (7)
287public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 290public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 831public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 842public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 862/// <param name="pred">The predicate input into the <see cref="GetRowCursor(IEnumerable{DataViewSchema.Column}, Random)"/> method.</param> 1449public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 1460public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
DataView\TypedCursor.cs (2)
182Random rand = randomSeed.HasValue ? RandomUtils.Create(randomSeed.Value) : null; 203public RowCursor<TRow>[] GetCursorSet(Func<int, bool> additionalColumnsPredicate, int n, Random rand)
DataView\ZipDataView.cs (2)
75public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 103public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
Dirty\ChooseColumnsByIndexTransform.cs (2)
245protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 258public sealed override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
Evaluators\AucAggregator.cs (6)
45protected AucAggregatorBase(Random rand, int reservoirSize) 125public UnweightedAucAggregator(Random rand, int reservoirSize) 226public WeightedAucAggregator(Random rand, int reservoirSize) 374protected AuPrcAggregatorBase(Random rand, int reservoirSize) 407public UnweightedAuPrcAggregator(Random rand, int reservoirSize) 481public WeightedAuPrcAggregator(Random rand, int reservoirSize)
Evaluators\RankingEvaluator.cs (2)
622public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 625public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
Prediction\Calibrator.cs (1)
1362private readonly Random _random;
Scorers\RowToRowScorerBase.cs (2)
129protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 142public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
Training\TrainerUtils.cs (10)
248public static DataViewRowCursor CreateRowCursor(this RoleMappedData data, CursOpt opt, Random rand, IEnumerable<int> extraCols = null) 256CursOpt opt, int n, Random rand, IEnumerable<int> extraCols = null) 514protected static DataViewRowCursor CreateCursor(RoleMappedData data, CursOpt opt, Random rand, params int[] extraCols) 617/// The typed analog to <see cref="IDataView.GetRowCursor(IEnumerable{DataViewSchema.Column},Random)"/>. 623public TCurs Create(Random rand = null, params int[] extraCols) 644public TCurs[] CreateSet(int n, Random rand = null, params int[] extraCols) 736public StandardScalarCursor(RoleMappedData data, CursOpt opt, Random rand = null, params int[] extraCols) 826Random rand = null, params int[] extraCols) 893Random rand = null, params int[] extraCols) 962Random rand = null, params int[] extraCols)
Transforms\BootstrapSamplingTransformer.cs (4)
168protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 179public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 189private readonly Random _rgen; 195public Cursor(BootstrapSamplingTransformer parent, DataViewRowCursor input, Random rgen)
Transforms\ColumnSelecting.cs (2)
679public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 692public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
Transforms\GenerateNumberTransform.cs (2)
337protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 350public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
Transforms\NAFilter.cs (2)
207protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 219public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
Transforms\NopTransform.cs (2)
120public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 123public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
Transforms\PerGroupTransformBase.cs (2)
157public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 163public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null)
Transforms\RangeFilter.cs (2)
208protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 220public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
Transforms\RowShufflingTransformer.cs (7)
225public static DataViewRowCursor GetShuffledCursor(IChannelProvider provider, int poolRows, DataViewRowCursor cursor, Random rand) 251protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 276Random myRandom = rand ?? (shouldShuffleMe || shouldShuffleSource ? RandomUtils.Create(_forceShuffleSeed) : null); 279Random sourceRand = shouldShuffleSource ? RandomUtils.Create(myRandom) : null; 290public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 467private readonly Random _rand; 502public Cursor(IChannelProvider provider, int poolRows, DataViewRowCursor input, Random rand)
Transforms\SkipTakeFilter.cs (2)
211protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 220public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
Transforms\TransformBase.cs (6)
65public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 71var rng = CanShuffle ? rand : null; 99protected abstract DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null); 101public abstract DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null); 734protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 746public sealed override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
Utilities\LocalEnvironment.cs (3)
66protected override IHost RegisterCore(HostEnvironmentBase<LocalEnvironment> source, string shortName, string parentFullName, Random rand, bool verbose) 93public Host(HostEnvironmentBase<LocalEnvironment> source, string shortName, string parentFullName, Random rand, bool verbose) 115protected override IHost RegisterCore(HostEnvironmentBase<LocalEnvironment> source, string shortName, string parentFullName, Random rand, bool verbose)
Microsoft.ML.DataView (9)
IDataView.cs (9)
47/// <param name="rand">An instance of <see cref="Random"/> to seed randomizing the access for a shuffled cursor.</param> 48DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null); 57/// <see cref="GetRowCursor(IEnumerable{DataViewSchema.Column}, Random)"/>, except partitioned: no two cursors should return the 66/// <see cref="GetRowCursor(IEnumerable{DataViewSchema.Column}, Random)"/>. 70/// <param name="rand">An instance of <see cref="Random"/> to seed randomizing the access.</param> 72DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null); 105/// <see cref="IDataView.GetRowCursorSet(IEnumerable{DataViewSchema.Column}, int, Random)"/>. When getting a set, there is a need 110/// identically configured <see cref="IDataView.GetRowCursor(IEnumerable{DataViewSchema.Column}, Random)"/>. So: for any cursor 113/// <see cref="IDataView.GetRowCursorSet(IEnumerable{DataViewSchema.Column}, int, Random)"/>. In this way, order is determined by
Microsoft.ML.Ensemble (10)
Selector\FeatureSelector\AllFeatureSelector.cs (1)
25public Subset SelectFeatures(RoleMappedData data, Random rand)
Selector\FeatureSelector\RandomFeatureSelector.cs (1)
47public Subset SelectFeatures(RoleMappedData data, Random rand)
Selector\IFeatureSelector.cs (1)
14Subset SelectFeatures(RoleMappedData data, Random rand);
Selector\ISubsetSelector.cs (2)
16IEnumerable<Batch> GetBatches(Random rand); 17IEnumerable<Subset> GetSubsets(Batch batch, Random rand);
Selector\SubsetSelector\AllInstanceSelector.cs (1)
36public override IEnumerable<Subset> GetSubsets(Batch batch, Random rand)
Selector\SubsetSelector\BaseSubsetSelector.cs (2)
55public abstract IEnumerable<Subset> GetSubsets(Batch batch, Random rand); 57public IEnumerable<Batch> GetBatches(Random rand)
Selector\SubsetSelector\BootstrapSelector.cs (1)
46public override IEnumerable<Subset> GetSubsets(Batch batch, Random rand)
Selector\SubsetSelector\RandomPartitionSelector.cs (1)
38public override IEnumerable<Subset> GetSubsets(Batch batch, Random rand)
Microsoft.ML.Fairlearn (1)
Reductions\Utilities.cs (1)
26var rand = new Random();
Microsoft.ML.FastTree (22)
Dataset\Dataset.cs (1)
582Random rnd = new Random(randomSeed);
FastTree.cs (1)
92private Random _featureSelectionRandom;
RandomForestRegression.cs (1)
540private readonly Random _rgen;
SumupPerformanceCommand.cs (8)
104private IEnumerable<int> CreateDense(IChannel ch, Random rgen) 110private IEnumerable<int> CreateSparse(IChannel ch, Random rgen) 160Func<IChannel, Random, IEnumerable<int>> createIntArray; 177Random r = new Random(salt + i); 186private IEnumerator<double> Geometric(double p, Random rgen) 212private IEnumerable<int> CreateDocIndicesCore(double sparsity, Random rgen) 230private IEnumerable<int> CreateDocIndices(double sparsity, Random rgen) 240private void InitSumupInputData(SumupInputData data, double sparsity, Random rgen)
Training\Applications\ObjectiveFunction.cs (1)
27private readonly Random _rnd;
Training\BaggingProvider.cs (1)
15protected Random RndGenerator;
Training\DocumentPartitioning.cs (1)
169public double[] GetDistribution(double[] targets, double[] weights, int quantileSampleCount, Random rand, int leafCount, out double[] distributionWeights)
Training\EnsembleCompression\LassoBasedEnsembleCompressor.cs (1)
56private Random _rnd;
Training\OptimizationAlgorithms\OptimizationAlgorithm.cs (1)
37public Random DropoutRng;
Training\ScoreTracker.cs (1)
89Random rndStart = new Random(rngSeed);
Training\TreeLearners\LeastSquaresRegressionTreeLearner.cs (1)
66protected readonly Random Rand;
Utils\LinqExtensions.cs (3)
84public static int ArgMaxRand<T>(this IEnumerable<T> e, Random rnd, double fraction) where T : IComparable<T> 124public static int ArgMaxRand<T>(this IEnumerable<T> e, int prefix, Random rnd, double fraction) where T : IComparable<T> 251public static int SoftArgMax(this IEnumerable<double> values, Random rand)
Utils\PseudorandomFunction.cs (1)
20public PseudorandomFunction(Random rand)
Microsoft.ML.GenAI.Mistral (1)
MistralCausalLMAgent.cs (1)
162var random = new Random();
Microsoft.ML.IntegrationTests (8)
Datasets\Iris.cs (1)
42var rng = new Random(seed);
Datasets\TypeTestData.cs (5)
111var rng = new Random(seed); 121/// <param name="rng">A <see cref="Random"/> object.</param> 123public static TypeTestData GetRandomInstance(Random rng) 149private static ReadOnlyMemory<char> GetRandomCharSpan(Random rng, int length = 10) 157private static float[] GetRandomFloatArray(Random rng, int length)
DataTransformation.cs (1)
220var rng = new Random(seed);
Prediction.cs (1)
87var rnd = new Random(1);
Microsoft.ML.KMeansClustering (9)
KMeansPlusPlusTrainer.cs (9)
918(ref VBuffer<float> point, int pointRowIndex, float[] weights, Random rand) => 930(float[][] workStateWeights, Random rand, ref float[] weights) => 945(ref VBuffer<float> point, int discard, float[] weights, Random rand) => weights[KMeansUtils.FindBestCluster(in point, clusters, clustersL2s)]++, 946(float[][] workStateWeights, Random rand, ref float[] weights) => 1615(ref VBuffer<float> point, int pointRowIndex, Heap<WeightedPoint> heap, Random rand) => 1651(Heap<WeightedPoint>[] heaps, Random rand, ref Heap<WeightedPoint> finalHeap) => 1690public delegate void MapAction<TPartitionState>(ref VBuffer<float> point, int rowIndex, TPartitionState state, Random rand); 1691public delegate void ReduceAction<TPartitionState, TGlobalState>(TPartitionState[] intermediates, Random rand, ref TGlobalState result); 1731Random rand = RandomUtils.Create(baseHost.Rand);
Microsoft.ML.LightGbm (6)
LightGbmTrainerBase.cs (6)
846private void GetFeatureValueDense(IChannel ch, FloatLabelCursor cursor, CategoricalMetaData catMetaData, Random rand, out ReadOnlySpan<float> featureValues) 884CategoricalMetaData catMetaData, Random rand, out ReadOnlySpan<int> indices, 942var rand = Host.Rand; 1032var rand = Host.Rand; 1133private void CopyToArray(IChannel ch, FloatLabelCursor cursor, float[] features, CategoricalMetaData catMetaData, Random rand, ref int numElem) 1172int[] indices, float[] features, CategoricalMetaData catMetaData, Random rand, ref int numElem)
Microsoft.ML.Parquet (8)
ParquetLoader.cs (4)
394public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 400public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 446private readonly Random _rand; 448public Cursor(ParquetLoader parent, IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand)
PartitionedFileLoader.cs (4)
297public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 302public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 388public Cursor(IChannelProvider provider, PartitionedFileLoader parent, IMultiStreamSource files, IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand) 648private IEnumerable<int> CreateFileOrder(Random rand)
Microsoft.ML.PCA (2)
PcaTrainer.cs (1)
283var rng = new Random(seed);
PcaTransformer.cs (1)
309var rnd = columns[iinfo].Seed == null ? Host.Rand : new Random(columns[iinfo].Seed.Value);
Microsoft.ML.PerformanceTests (4)
BenchmarkBase.cs (3)
74Random random = new Random(1); 84public static string CreateRandomLine(int columns, int maxWordLength, Random random) 95public static string CreateRandomColumn(int numwords, int maxWordLength, Random random)
CacheDataViewBench.cs (1)
60var rand = new Random(0);
Microsoft.ML.Predictor.Tests (4)
TestTransposer.cs (4)
106int rowCount, Double density, Random rgen, Func<T> generator, int slotCount, params int[] forceDenseSlot) 139private static T[] GenerateHelper<T>(int rowCount, Double density, Random rgen, Func<T> generator) 155Random rgen = new Random(0); 221Random rgen = new Random(1);
Microsoft.ML.Samples (103)
Dynamic\DataOperations\CrossValidationSplit.cs (1)
179var random = new Random(seed);
Dynamic\DataOperations\DataViewEnumerable.cs (1)
89var rng = new Random(1234321);
Dynamic\DataOperations\FilterRowsByColumn.cs (1)
89var rng = new Random(1234321);
Dynamic\DataOperations\LoadingSvmLight.cs (1)
15var random = new Random(42);
Dynamic\DataOperations\LoadingText.cs (1)
17var random = new Random(1);
Dynamic\DataOperations\ShuffleRows.cs (1)
77var rng = new Random(1234321);
Dynamic\DataOperations\SkipRows.cs (1)
81var rng = new Random(1234321);
Dynamic\DataOperations\TakeRows.cs (1)
82var rng = new Random(1234321);
Dynamic\DataOperations\TrainTestSplit.cs (1)
86var random = new Random(seed);
Dynamic\SimpleDataViewImplementation.cs (7)
126/// <see langword="false"/>, and even if a <see cref="Random"/> 128/// <see cref="GetRowCursor(IEnumerable{DataViewSchema.Column}, Random)"/>, 135/// IEnumerable{DataViewSchema.Column}, int, Random)"/> method returns a 173Random rand = null) 180Random rand = null) 202/// IEnumerable{DataViewSchema.Column}, int, Random)"/>, 224/// IEnumerable{DataViewSchema.Column}, Random)"/> method that was used
Dynamic\Trainers\BinaryClassification\AveragedPerceptron.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\AveragedPerceptronWithOptions.cs (1)
99var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\FactorizationMachine.cs (1)
96var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\FastForest.cs (1)
91var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\FastForestWithOptions.cs (1)
103var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\FastTree.cs (1)
94var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\FastTreeWithOptions.cs (1)
106var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\FieldAwareFactorizationMachine.cs (1)
145var rnd = new Random(seed);
Dynamic\Trainers\BinaryClassification\FieldAwareFactorizationMachineWithOptions.cs (1)
156var rnd = new Random(seed);
Dynamic\Trainers\BinaryClassification\Gam.cs (1)
145var rng = new Random(seed);
Dynamic\Trainers\BinaryClassification\GamWithOptions.cs (1)
152var rng = new Random(seed);
Dynamic\Trainers\BinaryClassification\LbfgsLogisticRegression.cs (1)
91var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\LbfgsLogisticRegressionWithOptions.cs (1)
100var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\LdSvm.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\LdSvmWithOptions.cs (1)
97var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\LightGbm.cs (1)
91var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\LightGbmWithOptions.cs (1)
102var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\LinearSvm.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\LinearSvmWithOptions.cs (1)
97var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\PermutationFeatureImportance.cs (1)
100var rng = new Random(seed);
Dynamic\Trainers\BinaryClassification\PermutationFeatureImportanceLoadFromDisk.cs (1)
86var rng = new Random(seed);
Dynamic\Trainers\BinaryClassification\PriorTrainer.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SdcaLogisticRegression.cs (1)
96var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SdcaLogisticRegressionWithOptions.cs (1)
108var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SdcaNonCalibrated.cs (1)
95var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SdcaNonCalibratedWithOptions.cs (1)
110var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SgdCalibrated.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SgdCalibratedWithOptions.cs (1)
100var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SgdNonCalibrated.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SgdNonCalibratedWithOptions.cs (1)
97var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SymbolicSgdLogisticRegression.cs (1)
91var random = new Random(seed);
Dynamic\Trainers\BinaryClassification\SymbolicSgdLogisticRegressionWithOptions.cs (1)
100var random = new Random(seed);
Dynamic\Trainers\Clustering\KMeans.cs (1)
95var random = new Random(seed);
Dynamic\Trainers\Clustering\KMeansWithOptions.cs (1)
103var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\LbfgsMaximumEntropy.cs (1)
92var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\LbfgsMaximumEntropyWithOptions.cs (1)
100var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\LightGbm.cs (1)
95var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\LightGbmWithOptions.cs (1)
105var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\LogLossPerClass.cs (1)
75var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\NaiveBayes.cs (1)
100var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\OneVersusAll.cs (1)
93var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\PairwiseCoupling.cs (1)
93var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\PermutationFeatureImportance.cs (1)
104var rng = new Random(seed);
Dynamic\Trainers\MulticlassClassification\PermutationFeatureImportanceLoadFromDisk.cs (1)
113var rng = new Random(seed);
Dynamic\Trainers\MulticlassClassification\SdcaMaximumEntropy.cs (1)
99var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\SdcaMaximumEntropyWithOptions.cs (1)
109var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\SdcaNonCalibrated.cs (1)
100var random = new Random(seed);
Dynamic\Trainers\MulticlassClassification\SdcaNonCalibratedWithOptions.cs (1)
109var random = new Random(seed);
Dynamic\Trainers\Ranking\FastTree.cs (1)
74var random = new Random(seed);
Dynamic\Trainers\Ranking\FastTreeWithOptions.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\Ranking\LightGbm.cs (1)
74var random = new Random(seed);
Dynamic\Trainers\Ranking\LightGbmWithOptions.cs (1)
89var random = new Random(seed);
Dynamic\Trainers\Ranking\PermutationFeatureImportance.cs (1)
114var rng = new Random(seed);
Dynamic\Trainers\Ranking\PermutationFeatureImportanceLoadFromDisk.cs (1)
121var rng = new Random(seed);
Dynamic\Trainers\Regression\FastForest.cs (1)
75var random = new Random(seed);
Dynamic\Trainers\Regression\FastForestWithOptions.cs (1)
88var random = new Random(seed);
Dynamic\Trainers\Regression\FastTree.cs (1)
75var random = new Random(seed);
Dynamic\Trainers\Regression\FastTreeTweedie.cs (1)
75var random = new Random(seed);
Dynamic\Trainers\Regression\FastTreeTweedieWithOptions.cs (1)
90var random = new Random(seed);
Dynamic\Trainers\Regression\FastTreeWithOptions.cs (1)
91var random = new Random(seed);
Dynamic\Trainers\Regression\Gam.cs (1)
75var random = new Random(seed);
Dynamic\Trainers\Regression\GamAdvanced.cs (1)
143var rng = new Random(seed);
Dynamic\Trainers\Regression\GamWithOptions.cs (1)
86var random = new Random(seed);
Dynamic\Trainers\Regression\GamWithOptionsAdvanced.cs (1)
151var rng = new Random(seed);
Dynamic\Trainers\Regression\LbfgsPoissonRegression.cs (1)
73var random = new Random(seed);
Dynamic\Trainers\Regression\LbfgsPoissonRegressionWithOptions.cs (1)
87var random = new Random(seed);
Dynamic\Trainers\Regression\LightGbm.cs (1)
76var random = new Random(seed);
Dynamic\Trainers\Regression\LightGbmWithOptions.cs (1)
95var random = new Random(seed);
Dynamic\Trainers\Regression\OnlineGradientDescent.cs (1)
64var random = new Random(seed);
Dynamic\Trainers\Regression\OnlineGradientDescentWithOptions.cs (1)
80var random = new Random(seed);
Dynamic\Trainers\Regression\OrdinaryLeastSquares.cs (1)
72var random = new Random(seed);
Dynamic\Trainers\Regression\OrdinaryLeastSquaresWithOptions.cs (1)
84var random = new Random(seed);
Dynamic\Trainers\Regression\PermutationFeatureImportance.cs (1)
110var rng = new Random(seed);
Dynamic\Trainers\Regression\PermutationFeatureImportanceLoadFromDisk.cs (1)
117var rng = new Random(seed);
Dynamic\Trainers\Regression\Sdca.cs (1)
72var random = new Random(seed);
Dynamic\Trainers\Regression\SdcaWithOptions.cs (1)
88var random = new Random(seed);
Dynamic\Transforms\CalculateFeatureContribution.cs (1)
119var rng = new Random(seed);
Dynamic\Transforms\CalculateFeatureContributionCalibrated.cs (1)
126var rng = new Random(seed);
Dynamic\Transforms\Conversion\MapKeyToValueMultiColumn.cs (1)
91var rnd = new Random(0);
Dynamic\Transforms\ImageAnalytics\ConvertToImage.cs (1)
97var random = new Random(seed);
Dynamic\Transforms\TreeFeaturization\FastForestBinaryFeaturizationWithOptions.cs (1)
125var random = new Random(seed);
Dynamic\Transforms\TreeFeaturization\FastForestRegressionFeaturizationWithOptions.cs (1)
126var random = new Random(seed);
Dynamic\Transforms\TreeFeaturization\FastTreeBinaryFeaturizationWithOptions.cs (1)
127var random = new Random(seed);
Dynamic\Transforms\TreeFeaturization\FastTreeRankingFeaturizationWithOptions.cs (1)
123var random = new Random(seed);
Dynamic\Transforms\TreeFeaturization\FastTreeRegressionFeaturizationWithOptions.cs (1)
126var random = new Random(seed);
Dynamic\Transforms\TreeFeaturization\FastTreeTweedieFeaturizationWithOptions.cs (1)
126var random = new Random(seed);
Dynamic\Transforms\TreeFeaturization\PretrainedTreeEnsembleFeaturizationWithOptions.cs (1)
134var random = new Random(seed);
Microsoft.ML.SamplesUtils (4)
SamplesDatasetUtils.cs (4)
246var rnd = new Random(0); 295var rnd = new Random(0); 309var rnd = new Random(0); 365var rnd = new Random(0);
Microsoft.ML.SearchSpace (1)
Tuner\RandomTuner.cs (1)
12private readonly Random _rnd;
Microsoft.ML.StandardTrainers (19)
FactorizationMachine\FactorizationMachineTrainer.cs (2)
307var rng = _host.Rand; 456var rng = shuffle ? _host.Rand : null;
LdSvm\LdSvmTrainer.cs (6)
497public abstract IEnumerable<VBuffer<float>> SampleForGammaUpdate(Random rand); 498public abstract IEnumerable<LabelFeatures> SampleExamples(Random rand); 529public override IEnumerable<LabelFeatures> SampleExamples(Random rand) 547public override IEnumerable<VBuffer<float>> SampleForGammaUpdate(Random rand) 582public override IEnumerable<VBuffer<float>> SampleForGammaUpdate(Random rand) 618public override IEnumerable<LabelFeatures> SampleExamples(Random rand)
Optimizer\DifferentiableFunction.cs (4)
163private static readonly Random _r = new Random(5); 260Random r = new Random(5); 299Random r = new Random(5); 356private static float SampleFromGaussian(Random r)
Standard\Online\OnlineLinear.cs (1)
322var rand = shuffle ? Host.Rand : null;
Standard\SdcaBinary.cs (4)
561var rands = new Random[maxIterations]; 790private protected virtual void TrainWithoutLock(IProgressChannelProvider progress, FloatLabelCursor.Factory cursorFactory, Random rand, 2108var trainingTasks = new Action<Random, IProgressChannel>[_options.NumberOfIterations]; 2109var rands = new Random[_options.NumberOfIterations];
Standard\SdcaMulticlass.cs (1)
174private protected override void TrainWithoutLock(IProgressChannelProvider progress, FloatLabelCursor.Factory cursorFactory, Random rand,
Standard\Simple\SimpleTrainers.cs (1)
58private readonly Random _random;
Microsoft.ML.Sweeper (3)
Algorithms\KdoSweeper.cs (1)
260Random rng = new Random();
Algorithms\SmacSweeper.cs (1)
301Random r = new Random();
Algorithms\SweeperProbabilityUtils.cs (1)
14private readonly Random _rng;
Microsoft.ML.Sweeper.Tests (9)
TestSweeper.cs (9)
69var random = new Random(123); 132var random = new Random(42); 182var random = new Random(42); 232var random = new Random(42); 300var random = new Random(42); 352var random = new Random(42); 540var random = new Random(42); 596var random = new Random(42); 644var random = new Random(42);
Microsoft.ML.TestFramework (1)
DataPipe\TestDataPipe.cs (1)
1169Random rgen = new Random(0);
Microsoft.ML.Tests (15)
CalibratedModelParametersTests.cs (1)
99var rand = new Random(10);
FeatureContributionTests.cs (1)
260var rand = new Random(10);
ImagesTests.cs (1)
1103var random = new Random(seed);
PermutationFeatureImportanceTests.cs (2)
817var rand = new Random(10); 884var rand = new Random(10);
Scenarios\Api\CookbookSamples\CookbookSamplesDynamicApi.cs (1)
487var r = new Random(454);
Scenarios\ClusteringTests.cs (1)
34var rand = new Random(1);
TrainerEstimators\FAFMEstimator.cs (1)
124var rnd = new Random(0);
TrainerEstimators\TreeEstimators.cs (1)
727var random = new Random(seed);
Transformers\LineParserTests.cs (1)
56Random rand = new Random();
Transformers\NormalizerTests.cs (3)
1111var rand = new Random(seed); 1182Random rand = new Random(0); 1256Random rand = new Random(0);
Transformers\RffTests.cs (2)
45Random rand = new Random(); 93Random rand = new Random();
Microsoft.ML.TimeSeries (7)
PValueTransform.cs (1)
111private Random _randomGen;
SequentialTransformBase.cs (2)
377protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 390public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
SequentialTransformerBase.cs (4)
565protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 582public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 866protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 875public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
Microsoft.ML.Tokenizers (1)
Model\Word.cs (1)
14private static Random? _random;
Microsoft.ML.Transforms (28)
CustomMappingFilter.cs (4)
37public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 51public abstract DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null); 73public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 153public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
Dracula\CountTableTransformer.cs (2)
686var rand = _addNoise ? new Random(_parent.Seeds[iinfo]) : null; 706var rand = _addNoise ? new Random(_parent.Seeds[iinfo]) : null;
Dracula\Featurizer.cs (2)
138public void GetFeatures(int iCol, int iSlot, Random rand, long key, Span<float> features) 171private float AddLaplacianNoisePerLabel(int iCol, Random rand, Span<float> counts)
FourierDistributionSampler.cs (3)
67public abstract float Next(Random rand); 184public override float Next(Random rand) 307public override float Next(Random rand)
GroupTransform.cs (2)
158protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 174public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
OptionalColumnTransform.cs (2)
323protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 336public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
ProduceIdTransform.cs (2)
140protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 153public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
RandomFourierFeaturizing.cs (1)
301var rng = columns[i].Seed.HasValue ? RandomUtils.Create(columns[i].Seed.Value) : Host.Rand;
StatefulCustomMappingTransformer.cs (2)
129public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 229protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null)
StatefulFilterTransform.cs (2)
103public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 115public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
SvmLight\SvmLightLoader.cs (4)
424public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 431public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) 791public DataViewRowCursor GetRowCursor(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) => _view.GetRowCursor(columnsNeeded, rand); 793public DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null) => _view.GetRowCursorSet(columnsNeeded, n, rand);
UngroupTransform.cs (2)
180protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null) 191int n, Random rand = null)
Microsoft.VisualBasic.Tests (2)
Microsoft\VisualBasic\ApplicationServices\SingleInstanceTests.cs (2)
184Random r = new(); 194static string getString(Random r)
MilvusPlayground.ApiService (1)
Program.cs (1)
45Random ran = new();
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
390[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Random))]
netstandard (1)
netstandard.cs (1)
1354[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Random))]
PresentationFramework (1)
System\Windows\Documents\FixedPageStructure.cs (1)
448Random random = new Random();
ProxylessEndToEnd.ApiService (1)
Program.cs (1)
17return Random.Shared.Next();
Roslyn.VisualStudio.Next.UnitTests (1)
Services\VisualStudioDiagnosticAnalyzerExecutorTests.cs (1)
126var random = new Random(Environment.TickCount);
Sample (1)
Endpoints\MapSchemasEndpoints.cs (1)
16schemas.MapGet("/multiple-results", Results<Ok<Triangle>, NotFound<string>> () => Random.Shared.Next(0, 2) == 0
ScenarioTests.Common.Tests (2)
ScenarioTestHelpers.cs (1)
231Random rand = new Random(seed);
ScenarioTestTypes.cs (1)
1139Random rand = new Random(seed);
Seq.ApiService (1)
Program.cs (1)
25var number = Random.Shared.Next(min, max);
Shared.Tests (5)
Pools\PoolTests.cs (1)
266var r = new Random(seed);
Throw\ThrowTest.cs (4)
144Random? somethingThatIsNull = null; 155Random? somethingThatIsNull = null; 156Random? somethingNestedThatIsNull = null; 170Random? somethingNestedThatIsNull = null;
Stress.ApiService (14)
ProducerConsumer.cs (2)
40await Task.Delay(Random.Shared.Next(10, 50)); 53await Task.Delay(Random.Shared.Next(10, 50));
Program.cs (1)
301Random.Shared.Next(-20, 55),
TestMetrics.cs (1)
36uploadSpeed.Add(Random.Shared.Next(5, 10));
TraceCreator.cs (10)
43await Task.Delay(Random.Shared.Next(10, 50)); 69if (Random.Shared.NextDouble() > 0.05) 85await Task.Delay(Random.Shared.Next(10, 50)); 89await Task.Delay(Random.Shared.Next(10, 50)); 95var eventCount = Random.Shared.Next(0, 5); 99var tagsCount = Random.Shared.Next(0, 5); 111var activityLinkCount = Random.Shared.Next(0, Math.Min(5, _allActivities.Count)); 117var tagsCount = Random.Shared.Next(0, 3); 126if (!IncludeBrokenLinks || Random.Shared.Next() % 2 == 0) 128var a = _allActivities[Random.Shared.Next(0, _allActivities.Count)];
Stress.AppHost (2)
TestResource.cs (2)
63var seconds = Random.Shared.Next(2, 12); 76var randomState = states[Random.Shared.Next(0, states.Length)];
Stress.TelemetryService (1)
TelemetryStresser.cs (1)
33value += Random.Shared.Next(0, 10);
System.Collections.Concurrent (1)
System\Collections\Concurrent\ConcurrentStack.cs (1)
631backoff = Random.Shared.Next(1, BACKOFF_MAX_YIELDS);
System.Data.Odbc (1)
Common\System\Data\ProviderBase\DbConnectionPool.cs (1)
96private static readonly Random s_random = new Random(5101977); // Value obtained from Dave Driver
System.Linq (11)
System\Linq\Shuffle.cs (1)
67Random.Shared.Shuffle(buffer);
System\Linq\Shuffle.SpeedOpt.cs (10)
17Random.Shared.Shuffle(array); 24Random.Shared.Shuffle(CollectionsMarshal.AsSpan(list)); 47return iterator.TryGetElementAt(Random.Shared.Next(0, iteratorCount), out found); 56return list[Random.Shared.Next(0, listCount)]; 172return iterator.TryGetElementAt(Random.Shared.Next(0, iteratorCount), out found); 181return list[Random.Shared.Next(0, count)]; 223int r = Random.Shared.Next(i + 1); 257long r = Random.Shared.NextInt64(i); 279Random.Shared.Shuffle(CollectionsMarshal.AsSpan(reservoir)); 378return Random.Shared.NextDouble() > probOfDrawingZeroMatches;
System.Linq.AsyncEnumerable (1)
System\Linq\Shuffle.cs (1)
38Random.Shared.Shuffle(array);
System.Net.Ping (1)
System\Net\NetworkInformation\Ping.RawSocket.cs (1)
28ushort id = (ushort)Random.Shared.Next(ushort.MaxValue + 1);
System.Numerics.Tensors (14)
System\Numerics\Tensors\netcore\Tensor.cs (14)
377return CreateAndFillGaussianNormalDistribution<T>(Random.Shared, lengths); 385public static Tensor<T> CreateAndFillGaussianNormalDistribution<T>(Random random, scoped ReadOnlySpan<nint> lengths) 401return CreateAndFillUniformDistribution<T>(Random.Shared, lengths); 409public static Tensor<T> CreateAndFillUniformDistribution<T>(Random random, scoped ReadOnlySpan<nint> lengths) 436/// Fills the given <see cref="TensorSpan{T}"/> with random data in a Gaussian normal distribution. <see cref="System.Random"/> 441/// <param name="random"><see cref="System.Random"/> to provide random seeding. Defaults to <see cref="Random.Shared"/> if not provided.</param> 443public static ref readonly TensorSpan<T> FillGaussianNormalDistribution<T>(in TensorSpan<T> destination, Random? random = null) where T : IFloatingPoint<T> 446random ??= Random.Shared; 459/// Fills the given <see cref="TensorSpan{T}"/> with random data in a uniform distribution. <see cref="System.Random"/> 464/// <param name="random"><see cref="System.Random"/> to provide random seeding. Defaults to <see cref="Random.Shared"/> if not provided.</param> 466public static ref readonly TensorSpan<T> FillUniformDistribution<T>(in TensorSpan<T> destination, Random? random = null) where T : IFloatingPoint<T> 469random ??= Random.Shared;
System.Private.CoreLib (13)
src\libraries\System.Private.CoreLib\src\System\Random.CompatImpl.cs (4)
118/// <summary>Reference to the <see cref="Random"/> containing this implementation instance.</summary> 120private readonly Random _parent; 126public CompatDerivedImpl(Random parent) : this(parent, Shared.Next()) { } 128public CompatDerivedImpl(Random parent, int seed)
src\libraries\System.Private.CoreLib\src\System\Random.cs (5)
28/// <summary>Initializes a new instance of the <see cref="Random"/> class using a default seed value.</summary> 33_impl = GetType() == typeof(Random) ? new XoshiroImpl() : new CompatDerivedImpl(this); 44_impl = GetType() == typeof(Random) ? new CompatSeedImpl(Seed) : new CompatDerivedImpl(this, Seed); 54/// <summary>Provides a thread-safe <see cref="Random"/> instance that may be used concurrently from any thread.</summary> 55public static Random Shared { get; } = new ThreadSafeRandom();
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.HillClimbing.cs (2)
75private readonly Random.XoshiroImpl _randomIntervalGenerator = new Random.XoshiroImpl();
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolWorkQueue.cs (2)
1280public readonly Random.XoshiroImpl random = new Random.XoshiroImpl();
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
417[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Random))]
System.Runtime.Extensions (1)
System.Runtime.Extensions.cs (1)
26[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Random))]
System.ServiceModel.NetNamedPipe (1)
System\Runtime\BackoffTimeoutHelper.cs (1)
17private readonly Random _random;
System.Text.RegularExpressions (6)
System\Text\RegularExpressions\Regex.Cache.cs (1)
57private static readonly Random s_random = new Random();
System\Text\RegularExpressions\Symbolic\SymbolicRegexMatcher.Sample.cs (5)
38Random random = randomseed != 0 ? new Random(randomseed) : new Random(); 172static T Choose<T>(Random random, IList<T> elems) => elems[random.Next(elems.Count)]; 174static char ChooseChar(Random random, BDD bdd, BDD ascii, CharSetSolver charSetSolver) 183static bool FlipBiasedCoin(Random random, double probTrue) => random.NextDouble() < probTrue; 185static T[] Shuffle<T>(Random random, T[] array)
System.Text.RegularExpressions.Generator (1)
RegexGenerator.Emitter.cs (1)
1500Random stackCookieGenerator = new(12345); // seed for deterministic behavior
System.Threading.Tasks.Parallel (1)
System\Threading\Tasks\TaskReplicator.cs (1)
167return 100 + Random.Shared.Next(0, 50 * Environment.ProcessorCount);
System.Windows.Forms.Tests (6)
System\Windows\Forms\ApplicationTests.cs (1)
579Random rnd = new Random();
System\Windows\Forms\ComboBoxTests.cs (2)
2428Random random = new(DateTime.Now.Millisecond); 2483Random random = new();
System\Windows\Forms\FontCacheTests.cs (1)
22Random random = new();
System\Windows\Forms\ListViewGroupTests.cs (1)
250Random random = new();
System\Windows\Forms\ScreenDcCacheTests.cs (1)
13Random random = new();
Templates.Blazor.Tests (1)
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
61private static char GetRandomLetter() => LetterChars[Random.Shared.Next(LetterChars.Length - 1)];
Templates.Blazor.WebAssembly.Auth.Tests (1)
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
61private static char GetRandomLetter() => LetterChars[Random.Shared.Next(LetterChars.Length - 1)];
Templates.Blazor.WebAssembly.Tests (1)
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
61private static char GetRandomLetter() => LetterChars[Random.Shared.Next(LetterChars.Length - 1)];
Templates.Mvc.Tests (1)
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
61private static char GetRandomLetter() => LetterChars[Random.Shared.Next(LetterChars.Length - 1)];
Templates.Tests (1)
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
61private static char GetRandomLetter() => LetterChars[Random.Shared.Next(LetterChars.Length - 1)];
TestingAppHost1.MyWebApp (2)
Program.cs (2)
29Random.Shared.Next(-20, 55), 30summaries[Random.Shared.Next(summaries.Length)]
TestProject.AppHost (1)
TestProgram.cs (1)
54builder.Configuration["DcpPublisher:ResourceNameSuffix"] = $"{Random.Shared.Next():x}";
TestReferenceAssembly (6)
OtherDllClass.cs (4)
41Random r = new Random(); 73Random r = new Random(); 102Random r = new Random(); 131Random r = new Random();
OtherDllStaticMethods.cs (2)
37Random r = new Random(); 75Random r = new Random();
Wasm.Performance.TestApp (1)
Person.cs (1)
20var rng = new Random(0);
WinFormsControlsTest (2)
ListViewTest.cs (2)
18Random random = new(); 227Random random = new();
Yarp.Backend (2)
Program.cs (2)
24Random.Shared.Next(-20, 55), 25summaries[Random.Shared.Next(summaries.Length)]