repo.or.cz
/
sunny256-utils.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
datefmt: Define 1 year as 365.2425 days instead of 365.25
[sunny256-utils.git]
/
mixline
blob
1339e33f208df9d169f569f5623ea7aa3cfd3cc8
1
#!/usr/bin/env perl
2
3
# mixline
4
# File ID: b1e95adc-5d3f-11df-b77c-90e6ba3022ac
5
# Blander linjer tilfeldig.
6
7
use
strict
;
8
use
warnings
;
9
10
my
@Linjer
= <>;
11
12
mix_array
(
\
@Linjer
);
13
14
foreach
(
@Linjer
) {
15
print
;
16
}
17
18
sub
mix_array
{
19
my
$array
=
shift
;
20
my
$i
;
21
for
(
$i
=
@
$array
; --
$i
; ) {
22
my
$j
=
int rand
(
$i
+
1
);
23
next if
$i
==
$j
;
24
@
$array
[
$i
,
$j
] =
@
$array
[
$j
,
$i
];
25
}
26
}
# mix_array()