@@ -68,11 +68,12 @@ public async Task<IEnumerable<WeatherForecast>> Get()
68
68
throw new HttpRequestException ( $ "Invalid status code in the HttpResponseMessage: { response . StatusCode } : { error } ") ;
69
69
}
70
70
71
+ var rng = new Random ( ) ;
71
72
return Enumerable . Range ( 1 , 5 ) . Select ( index => new WeatherForecast
72
73
{
73
74
Date = DateTime . Now . AddDays ( index ) ,
74
- TemperatureC = Random . Shared . Next ( - 20 , 55 ) ,
75
- Summary = Summaries [ Random . Shared . Next ( Summaries . Length ) ]
75
+ TemperatureC = rng . Next ( - 20 , 55 ) ,
76
+ Summary = Summaries [ rng . Next ( Summaries . Length ) ]
76
77
} )
77
78
. ToArray ( ) ;
78
79
}
@@ -93,11 +94,12 @@ public async Task<IEnumerable<WeatherForecast>> Get()
93
94
HttpContext . VerifyUserHasAnyAcceptedScope ( scopeRequiredByApi ) ;
94
95
var user = await _graphServiceClient . Me . Request ( ) . GetAsync ( ) ;
95
96
97
+ var rng = new Random ( ) ;
96
98
return Enumerable . Range ( 1 , 5 ) . Select ( index => new WeatherForecast
97
99
{
98
100
Date = DateTime . Now . AddDays ( index ) ,
99
- TemperatureC = Random . Shared . Next ( - 20 , 55 ) ,
100
- Summary = Summaries [ Random . Shared . Next ( Summaries . Length ) ]
101
+ TemperatureC = rng . Next ( - 20 , 55 ) ,
102
+ Summary = Summaries [ rng . Next ( Summaries . Length ) ]
101
103
} )
102
104
. ToArray ( ) ;
103
105
}
@@ -114,11 +116,12 @@ public IEnumerable<WeatherForecast> Get()
114
116
HttpContext . VerifyUserHasAnyAcceptedScope ( scopeRequiredByApi ) ;
115
117
116
118
#endif
119
+ var rng = new Random ( ) ;
117
120
return Enumerable . Range ( 1 , 5 ) . Select ( index => new WeatherForecast
118
121
{
119
122
Date = DateTime . Now . AddDays ( index ) ,
120
- TemperatureC = Random . Shared . Next ( - 20 , 55 ) ,
121
- Summary = Summaries [ Random . Shared . Next ( Summaries . Length ) ]
123
+ TemperatureC = rng . Next ( - 20 , 55 ) ,
124
+ Summary = Summaries [ rng . Next ( Summaries . Length ) ]
122
125
} )
123
126
. ToArray ( ) ;
124
127
}
0 commit comments