repo.or.cz
/
lcapit-junk-code.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
web: home-page: Add tcc.html to index.html
[lcapit-junk-code.git]
/
mega-sena.sh
blob
9daeaf3e0062c0bfda9cdde271254727c6592e65
1
#!/bin/bash
2
#
3
# Mega-sena loterry
4
#
5
# Luiz Fernando N. Capitulino
6
# <lcapitulino@gmail.com>
7
8
NUMBERS
=
""
9
MAX_NUMS
=
6
10
11
megasena
()
12
{
13
local
max
=
$1
14
local
j
=
0
15
local
nr
=
0
16
17
for
((
i
=
0
;
i
<
max
; ));
do
18
nr
=
$
((
$RANDOM
%
60
))
19
for
j
in
$NUMBER
;
do
20
if
[
$nr
-eq
$j
];
then
21
break
22
fi
23
done
24
25
if
[
$nr
-ne
$j
];
then
26
NUMBERS
=
"
$NUMBERS
$nr
"
27
((
i
++))
28
fi
29
done
30
}
31
32
if
[
$#
-eq
1
];
then
33
if
[
$1
-ge
6
-a
$1
-le
15
];
then
34
MAX_NUMS
=
$1
35
fi
36
fi
37
38
megasena
$MAX_NUMS
39
echo
$NUMBERS