~ubuntu-branches/ubuntu/trusty/bash/trusty-security

« back to all changes in this revision

Viewing changes to tests/arith3.sub

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-03-03 22:52:05 UTC
  • mfrom: (1.3.5) (2.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20140303225205-87ltrt5kspeq0g1b
Tags: 4.3-1ubuntu1
* Merge with Debian; remaining changes:
  - skel.bashrc:
    - Run lesspipe.
    - Enable ls aliases.
    - Set options in ll alias to -alF.
    - Define an alert alias.
    - Enabled colored grep aliases.
  - etc.bash.bashrc:
    - Add sudo hint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
RANDOM=42
 
2
(( dice[RANDOM%6+1 + RANDOM%6+1]++ ))
 
3
echo ${dice[5]}
 
4
 
 
5
(( ++dice[RANDOM%6+1 + RANDOM%6+1] ))
 
6
echo ${dice[6]}
 
7
 
 
8
v=4
 
9
DIND=20
 
10
 
 
11
(( dice[DIND%6 + 1]=v ))
 
12
echo ${dice[3]}
 
13
 
 
14
RANDOM=42
 
15
 
 
16
(( dice[RANDOM%6+1 + RANDOM%6+1]+=v ))
 
17
echo ${dice[5]}
 
18
 
 
19
(( dice[RANDOM%6+1 + RANDOM%6+1]-=v ))
 
20
echo ${dice[6]}
 
21
 
 
22
(( dice[RANDOM%6+1 + RANDOM%6+1]+=2 ))
 
23
echo ${dice[11]}
 
24
 
 
25
(( dice[RANDOM%6+1 + RANDOM%6+1]*=2 ))
 
26
echo ${dice[11]}
 
27
 
 
28
unset dice1 dice2
 
29
RANDOM=42
 
30
 
 
31
for i in {1..5000}; do ((dice1[$RANDOM%6+1 + $RANDOM%6+1]++)); done;
 
32
unset t; for i in ${dice1[@]}; do ((t+=i)); done; echo $t
 
33
 
 
34
foo="${dice1[@]}"
 
35
 
 
36
RANDOM=42
 
37
 
 
38
for i in {1..5000}; do ((dice2[RANDOM%6+1 + RANDOM%6+1]++)); done;
 
39
unset t; for i in ${dice2[@]}; do ((t+=i)); done; echo $t
 
40
 
 
41
bar="${dice2[@]}"
 
42
 
 
43
if [ "$foo" != "$bar" ]; then
 
44
        echo "random sequences differ"
 
45
fi