Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
Lottery
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
十年打工还是工,梭哈一夜往皇宫
Lottery
Commits
5580a06f
Commit
5580a06f
authored
Oct 23, 2019
by
caiwg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复人员随机数生成最大值及返回格式问题
parent
4391dbdc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
RandomOrg.cs
Lottery/Lottery/RandomOrg.cs
+3
-2
No files found.
Lottery/Lottery/RandomOrg.cs
View file @
5580a06f
...
@@ -48,7 +48,7 @@ namespace Lottery
...
@@ -48,7 +48,7 @@ namespace Lottery
using
(
HttpClient
httpClient
=
new
HttpClient
())
using
(
HttpClient
httpClient
=
new
HttpClient
())
{
{
httpClient
.
DefaultRequestHeaders
.
TryAddWithoutValidation
(
"user-agent"
,
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3936.0 Safari/537.36 Edg/79.0.301.2"
);
httpClient
.
DefaultRequestHeaders
.
TryAddWithoutValidation
(
"user-agent"
,
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3936.0 Safari/537.36 Edg/79.0.301.2"
);
var
resp
=
await
httpClient
.
GetAsync
(
$"https://www.random.org/integer-sets/?sets=1&num=
{
length
}
&min=
1&max=
{
length
}
&commas=on&order=random&format=html
&rnd=new"
);
var
resp
=
await
httpClient
.
GetAsync
(
$"https://www.random.org/integer-sets/?sets=1&num=
{
length
}
&min=
0&max=
{
length
-
1
}
&commas=on&order=random&format=plain
&rnd=new"
);
if
(
resp
.
IsSuccessStatusCode
)
if
(
resp
.
IsSuccessStatusCode
)
{
{
string
content
=
await
resp
.
Content
.
ReadAsStringAsync
();
string
content
=
await
resp
.
Content
.
ReadAsStringAsync
();
...
@@ -60,7 +60,8 @@ namespace Lottery
...
@@ -60,7 +60,8 @@ namespace Lottery
{
{
}
}
return
null
;
var
r
=
new
Random
(
length
);
return
Enumerable
.
Range
(
0
,
length
).
Select
(
p
=>
r
.
Next
(
1
,
length
+
1
)).
ToList
();
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment