Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
unix
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
tu-wien
unix
Commits
2206728f
Commit
2206728f
authored
Jan 13, 2019
by
Ivaylo Ivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a larger randomizer base
parent
041fac99
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
fb_arc_set/generator.c
fb_arc_set/generator.c
+3
-2
No files found.
fb_arc_set/generator.c
View file @
2206728f
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
void
swap
(
int
*
a
,
int
*
b
);
void
swap
(
int
*
a
,
int
*
b
);
void
shuffle
(
int
arr
[],
size_t
size
);
void
shuffle
(
int
arr
[],
size_t
size
);
static
unsigned
int
base_seed
=
0
;
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
<
2
)
{
if
(
argc
<
2
)
{
...
@@ -189,8 +190,8 @@ void swap(int *a, int *b) {
...
@@ -189,8 +190,8 @@ void swap(int *a, int *b) {
* @return res
* @return res
**/
**/
void
shuffle
(
int
arr
[],
size_t
size
)
{
void
shuffle
(
int
arr
[],
size_t
size
)
{
base_seed
=
(
base_seed
+
1
)
%
(
__UINT64_MAX__
);
///< Extreme values for the randomizer
srand
(
time
(
NULL
)
);
///< Set a random seed
srand
(
base_seed
);
///< Set a random seed
int
j
=
0
;
///< Index that will be randomized later on
int
j
=
0
;
///< Index that will be randomized later on
for
(
int
i
=
size
-
1
;
i
>
0
;
i
--
)
{
for
(
int
i
=
size
-
1
;
i
>
0
;
i
--
)
{
...
...
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