bash script to handle 9000 lines of text by groups of 25 - bash

I have an input file with 9095 lines of text. I need to take this list of filenames and use them as input to an ffmpeg command. I really would like to avoid running it all at once (line by line until end of file).
Is there a way in a bash script to take the first 25 lines, execute the ffmpeg command on them, then continue to the next 25 lines and execute the same command, until the end of the input file?
Input file (example.txt) has list of 9095 filenames to be processed.
I have tried the following:
#!/bin/bash
while mapfile -n 25 convert < example.txt do
while read -r line || [[ -n "$line" ]]; do fn_out="w$line"; (/path/to/file/ffmpeg -report -nostdin -i /path/to/file/watermark.png -i /path/to/file/"$line" -filter_complex "scale2ref[a][b];[b][a]overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2" /path/to/file/"$fn_out" -c:v libx265); done < $convert >> script.txt
done
This only gets me the first 25 files. How to account for all 9095 files in example.txt?
Also, is there any way to "pause" the script in between each set of 25 filenames? I am not familiar enough with mapfile and bash scripting to know how to handle this kind of iteration.
Basically, the output needs to be as follows:
Read first 25 lines of example.txt
Run the ffmpeg command on those 25 files (some files are over 2GB. Will take time to do the ffmpeg command.
Pause for about a minute or two. Let server rest/catch up/recover resources.
Get the next 25 names from example.txt
Run the ffmpeg conversion loop again in step 2
Continue until EOF of example.txt
Any direction on this would be greatly appreciated!
Running CentOS 7 with bash 5.0.17.

Assumptions/understandings:
files are to be processed one-at-a-time and serially
after a batch of 25 files have been processed sleep for 60 seconds
One bash approach using a simple counter (and no need for an array):
maxcnt=25
fcnt=0
while read -r fname
do
echo "run ffmpeg against $fname"
((++fcnt % maxcnt == 0)) && sleep 60
done < file.txt
Setup a small demo:
10 filenames in file.txt
process 3 files and then sleep
sleep for 2 seconds (also print message 'sleep 2')
Run the demo:
$ printf "file%s\n" {1..10} > file.txt
$ cat file.txt
file1
file2
file3
file4
file5
file6
file7
file8
file9
file10
$ maxcnt=3; fcnt=0
$ while read -r fname; do echo "run ffmpeg against $fname"; ((++fcnt % maxcnt == 0)) && echo "sleep 2" && sleep 2; done < file.txt; echo "Done."
run ffmpeg against file1
run ffmpeg against file2
run ffmpeg against file3
sleep 2
run ffmpeg against file4
run ffmpeg against file5
run ffmpeg against file6
sleep 2
run ffmpeg against file7
run ffmpeg against file8
run ffmpeg against file9
sleep 2
run ffmpeg against file10
Done.

You need to put the redirection around the entire loop, not just the mapfile line. Just like when you use while read to iterate through a file one line at a time.
while mapfile -tn 25 convert && [[ -n "${convert[#]}" ]]; do
# code that uses $convert array
done < example.txt
Then each time through the loop it will get the next 25 lines of the file.

With mapfile aka readarray, something like:
#!/usr/bin/env bash
num=25
while mapfile -tn "$num" files && (( ${#files[*]} == num )); do
((sum+=${#files[*]}))
for i in "${!files[#]}"; do
echo do_something_with "${files[$i]}"
done
((sum < 9000)) && sleep 60
done < file.txt
A simple test run.
num=25
while mapfile -tn "$num" files && (( ${#files[*]} == num )); do
((sum+=${#files[*]}))
for i in "${!files[#]}"; do
echo do_something_with "${files[$i]}"
done
((sum < 9000)) && echo ===
done < <(printf '%s\n' {1..9000})
Output:
do_something_with 1
do_something_with 2
do_something_with 3
do_something_with 4
do_something_with 5
do_something_with 6
do_something_with 7
do_something_with 8
do_something_with 9
do_something_with 10
do_something_with 11
do_something_with 12
do_something_with 13
do_something_with 14
do_something_with 15
do_something_with 16
do_something_with 17
do_something_with 18
do_something_with 19
do_something_with 20
do_something_with 21
do_something_with 22
do_something_with 23
do_something_with 24
do_something_with 25
===
do_something_with 26
do_something_with 27
do_something_with 28
do_something_with 29
do_something_with 30
do_something_with 31
do_something_with 32
do_something_with 33
do_something_with 34
do_something_with 35
do_something_with 36
do_something_with 37
do_something_with 38
do_something_with 39
do_something_with 40
do_something_with 41
do_something_with 42
do_something_with 43
do_something_with 44
do_something_with 45
do_something_with 46
do_something_with 47
do_something_with 48
do_something_with 49
do_something_with 50
===
do_something_with 51
do_something_with 52
do_something_with 53
do_something_with 54
do_something_with 55
do_something_with 56
do_something_with 57
do_something_with 58
do_something_with 59
do_something_with 60
do_something_with 61
do_something_with 62
do_something_with 63
do_something_with 64
do_something_with 65
do_something_with 66
do_something_with 67
do_something_with 68
do_something_with 69
do_something_with 70
do_something_with 71
do_something_with 72
do_something_with 73
do_something_with 74
do_something_with 75
===
do_something_with 76
do_something_with 77
do_something_with 78
do_something_with 79
do_something_with 80
do_something_with 81
do_something_with 82
do_something_with 83
do_something_with 84
do_something_with 85
do_something_with 86
do_something_with 87
do_something_with 88
do_something_with 89
do_something_with 90
do_something_with 91
do_something_with 92
do_something_with 93
do_something_with 94
do_something_with 95
do_something_with 96
do_something_with 97
do_something_with 98
do_something_with 99
do_something_with 100
===
do_something_with 101
do_something_with 102
do_something_with 103
do_something_with 104
do_something_with 105
do_something_with 106
do_something_with 107
do_something_with 108
do_something_with 109
do_something_with 110
do_something_with 111
do_something_with 112
do_something_with 113
do_something_with 114
do_something_with 115
do_something_with 116
do_something_with 117
do_something_with 118
do_something_with 119
do_something_with 120
do_something_with 121
do_something_with 122
do_something_with 123
do_something_with 124
do_something_with 125
===
do_something_with 126
do_something_with 127
do_something_with 128
do_something_with 129
do_something_with 130
do_something_with 131
do_something_with 132
do_something_with 133
do_something_with 134
do_something_with 135
do_something_with 136
do_something_with 137
do_something_with 138
do_something_with 139
do_something_with 140
do_something_with 141
do_something_with 142
do_something_with 143
do_something_with 144
do_something_with 145
do_something_with 146
do_something_with 147
do_something_with 148
do_something_with 149
do_something_with 150
===
do_something_with 151
do_something_with 152
do_something_with 153
do_something_with 154
do_something_with 155
do_something_with 156
do_something_with 157
do_something_with 158
do_something_with 159
do_something_with 160
do_something_with 161
do_something_with 162
do_something_with 163
do_something_with 164
do_something_with 165
do_something_with 166
do_something_with 167
do_something_with 168
do_something_with 169
do_something_with 170
do_something_with 171
do_something_with 172
do_something_with 173
do_something_with 174
do_something_with 175
===
do_something_with 176
do_something_with 177
do_something_with 178
do_something_with 179
do_something_with 180
do_something_with 181
do_something_with 182
do_something_with 183
do_something_with 184
do_something_with 185
do_something_with 186
do_something_with 187
do_something_with 188
do_something_with 189
do_something_with 190
do_something_with 191
do_something_with 192
do_something_with 193
do_something_with 194
do_something_with 195
do_something_with 196
do_something_with 197
do_something_with 198
do_something_with 199
do_something_with 200
===
do_something_with 201
do_something_with 202
do_something_with 203
do_something_with 204
do_something_with 205
do_something_with 206
do_something_with 207
do_something_with 208
do_something_with 209
do_something_with 210
do_something_with 211
do_something_with 212
do_something_with 213
do_something_with 214
do_something_with 215
do_something_with 216
do_something_with 217
do_something_with 218
do_something_with 219
do_something_with 220
do_something_with 221
do_something_with 222
do_something_with 223
do_something_with 224
do_something_with 225
===
do_something_with 226
do_something_with 227
do_something_with 228
do_something_with 229
do_something_with 230
do_something_with 231
do_something_with 232
do_something_with 233
do_something_with 234
do_something_with 235
do_something_with 236
do_something_with 237
do_something_with 238
do_something_with 239
do_something_with 240
do_something_with 241
do_something_with 242
do_something_with 243
do_something_with 244
do_something_with 245
do_something_with 246
do_something_with 247
do_something_with 248
do_something_with 249
do_something_with 250
===
do_something_with 251
do_something_with 252
do_something_with 253
do_something_with 254
do_something_with 255
do_something_with 256
do_something_with 257
do_something_with 258
do_something_with 259
do_something_with 260
do_something_with 261
do_something_with 262
do_something_with 263
do_something_with 264
do_something_with 265
do_something_with 266
do_something_with 267
do_something_with 268
do_something_with 269
do_something_with 270
do_something_with 271
do_something_with 272
do_something_with 273
do_something_with 274
do_something_with 275
===
do_something_with 276
do_something_with 277
do_something_with 278
do_something_with 279
do_something_with 280
do_something_with 281
do_something_with 282
do_something_with 283
do_something_with 284
do_something_with 285
do_something_with 286
do_something_with 287
do_something_with 288
do_something_with 289
do_something_with 290
do_something_with 291
do_something_with 292
do_something_with 293
do_something_with 294
do_something_with 295
do_something_with 296
do_something_with 297
do_something_with 298
do_something_with 299
do_something_with 300
===
do_something_with 301
do_something_with 302
do_something_with 303
do_something_with 304
do_something_with 305
do_something_with 306
do_something_with 307
do_something_with 308
do_something_with 309
do_something_with 310
do_something_with 311
do_something_with 312
do_something_with 313
do_something_with 314
do_something_with 315
do_something_with 316
do_something_with 317
do_something_with 318
do_something_with 319
do_something_with 320
do_something_with 321
do_something_with 322
do_something_with 323
do_something_with 324
do_something_with 325
===
do_something_with 326
do_something_with 327
do_something_with 328
do_something_with 329
do_something_with 330
do_something_with 331
do_something_with 332
do_something_with 333
do_something_with 334
do_something_with 335
do_something_with 336
do_something_with 337
do_something_with 338
do_something_with 339
do_something_with 340
do_something_with 341
do_something_with 342
do_something_with 343
do_something_with 344
do_something_with 345
do_something_with 346
do_something_with 347
do_something_with 348
do_something_with 349
do_something_with 350
===
do_something_with 351
do_something_with 352
do_something_with 353
do_something_with 354
do_something_with 355
do_something_with 356
do_something_with 357
do_something_with 358
do_something_with 359
do_something_with 360
do_something_with 361
do_something_with 362
do_something_with 363
do_something_with 364
do_something_with 365
do_something_with 366
do_something_with 367
do_something_with 368
do_something_with 369
do_something_with 370
do_something_with 371
do_something_with 372
do_something_with 373
do_something_with 374
do_something_with 375
===
do_something_with 376
do_something_with 377
do_something_with 378
do_something_with 379
do_something_with 380
do_something_with 381
do_something_with 382
do_something_with 383
do_something_with 384
do_something_with 385
do_something_with 386
do_something_with 387
do_something_with 388
do_something_with 389
do_something_with 390
do_something_with 391
do_something_with 392
do_something_with 393
do_something_with 394
do_something_with 395
do_something_with 396
do_something_with 397
do_something_with 398
do_something_with 399
do_something_with 400
===
do_something_with 401
do_something_with 402
do_something_with 403
do_something_with 404
do_something_with 405
do_something_with 406
do_something_with 407
do_something_with 408
do_something_with 409
do_something_with 410
do_something_with 411
do_something_with 412
do_something_with 413
do_something_with 414
do_something_with 415
do_something_with 416
do_something_with 417
do_something_with 418
do_something_with 419
do_something_with 420
do_something_with 421
do_something_with 422
do_something_with 423
do_something_with 424
do_something_with 425
===
do_something_with 426
do_something_with 427
do_something_with 428
do_something_with 429
do_something_with 430
do_something_with 431
do_something_with 432
do_something_with 433
do_something_with 434
do_something_with 435
do_something_with 436
do_something_with 437
do_something_with 438
do_something_with 439
do_something_with 440
do_something_with 441
do_something_with 442
do_something_with 443
do_something_with 444
do_something_with 445
do_something_with 446
do_something_with 447
do_something_with 448
do_something_with 449
do_something_with 450
===
do_something_with 451
do_something_with 452
do_something_with 453
do_something_with 454
do_something_with 455
do_something_with 456
do_something_with 457
do_something_with 458
do_something_with 459
do_something_with 460
do_something_with 461
do_something_with 462
do_something_with 463
do_something_with 464
do_something_with 465
do_something_with 466
do_something_with 467
do_something_with 468
do_something_with 469
do_something_with 470
do_something_with 471
do_something_with 472
do_something_with 473
do_something_with 474
do_something_with 475
===
do_something_with 476
do_something_with 477
do_something_with 478
do_something_with 479
do_something_with 480
do_something_with 481
do_something_with 482
do_something_with 483
do_something_with 484
do_something_with 485
do_something_with 486
do_something_with 487
do_something_with 488
do_something_with 489
do_something_with 490
do_something_with 491
do_something_with 492
do_something_with 493
do_something_with 494
do_something_with 495
do_something_with 496
do_something_with 497
do_something_with 498
do_something_with 499
do_something_with 500
===
do_something_with 501
do_something_with 502
do_something_with 503
do_something_with 504
do_something_with 505
do_something_with 506
do_something_with 507
do_something_with 508
do_something_with 509
do_something_with 510
do_something_with 511
do_something_with 512
do_something_with 513
do_something_with 514
do_something_with 515
do_something_with 516
do_something_with 517
do_something_with 518
do_something_with 519
do_something_with 520
do_something_with 521
do_something_with 522
do_something_with 523
do_something_with 524
do_something_with 525
===
do_something_with 526
do_something_with 527
do_something_with 528
do_something_with 529
do_something_with 530
do_something_with 531
do_something_with 532
do_something_with 533
do_something_with 534
do_something_with 535
do_something_with 536
do_something_with 537
do_something_with 538
do_something_with 539
do_something_with 540
do_something_with 541
do_something_with 542
do_something_with 543
do_something_with 544
do_something_with 545
do_something_with 546
do_something_with 547
do_something_with 548
do_something_with 549
do_something_with 550
===
do_something_with 551
do_something_with 552
do_something_with 553
do_something_with 554
do_something_with 555
do_something_with 556
do_something_with 557
do_something_with 558
do_something_with 559
do_something_with 560
do_something_with 561
do_something_with 562
do_something_with 563
do_something_with 564
do_something_with 565
do_something_with 566
do_something_with 567
do_something_with 568
do_something_with 569
do_something_with 570
do_something_with 571
do_something_with 572
do_something_with 573
do_something_with 574
do_something_with 575
===
do_something_with 576
do_something_with 577
do_something_with 578
do_something_with 579
do_something_with 580
do_something_with 581
do_something_with 582
do_something_with 583
do_something_with 584
do_something_with 585
do_something_with 586
do_something_with 587
do_something_with 588
do_something_with 589
do_something_with 590
do_something_with 591
do_something_with 592
do_something_with 593
do_something_with 594
do_something_with 595
do_something_with 596
do_something_with 597
do_something_with 598
do_something_with 599
do_something_with 600
===
do_something_with 601
do_something_with 602
do_something_with 603
do_something_with 604
do_something_with 605
do_something_with 606
do_something_with 607
do_something_with 608
do_something_with 609
do_something_with 610
do_something_with 611
do_something_with 612
do_something_with 613
do_something_with 614
do_something_with 615
do_something_with 616
do_something_with 617
do_something_with 618
do_something_with 619
do_something_with 620
do_something_with 621
do_something_with 622
do_something_with 623
do_something_with 624
do_something_with 625
===
do_something_with 626
do_something_with 627
do_something_with 628
do_something_with 629
do_something_with 630
do_something_with 631
do_something_with 632
do_something_with 633
do_something_with 634
do_something_with 635
do_something_with 636
do_something_with 637
do_something_with 638
do_something_with 639
do_something_with 640
do_something_with 641
do_something_with 642
do_something_with 643
...
do_something_with 8976
do_something_with 8977
do_something_with 8978
do_something_with 8979
do_something_with 8980
do_something_with 8981
do_something_with 8982
do_something_with 8983
do_something_with 8984
do_something_with 8985
do_something_with 8986
do_something_with 8987
do_something_with 8988
do_something_with 8989
do_something_with 8990
do_something_with 8991
do_something_with 8992
do_something_with 8993
do_something_with 8994
do_something_with 8995
do_something_with 8996
do_something_with 8997
do_something_with 8998
do_something_with 8999
do_something_with 9000
The (( ${#files[*]} == num )) will execute the loop if it is true, if that is not desired just test if the array files has a value (regardless if it is less than 25 elements), change it to (( ${#files[*]} ))
wc -l < file.txt to get the total lines in a file, to save that in a variable you could do, total_lines=$(wc -l < file.txt)
Update:
Instead of using wc -l < file.txt (not to hardcode the total number of lines in a file) to save the number of lines in a variable, something like:
#!/usr/bin/env bash
sum=0
num=25
total_lines=$(wc -l < file.txt)
while mapfile -tn "$num" files && (( ${#files[*]} )); do
((sum+=${#files[*]}))
for i in "${!files[#]}"; do
echo do_something_with "${files[$i]}"
done
if ((sum < total_lines)); then
echo ===
else
printf 'All is done!\n'
fi
done < file.txt
Adapting to #mark-mapuso's modulus approach, something like:
#!/usr/bin/env bash
sum=0
num=25
while mapfile -tn "$num" files && ((${#files[*]})); do
((sum+=${#files[*]}))
for i in "${!files[#]}"; do
echo do_something_with "${files[$i]}"
done
if ((sum % num == 0)); then
sleep 60
else
printf 'All done!\n'
fi
done < file.txt

Related

PDF Document with XObject jpg Image not displaying in Adobe Reader

Self-created PDF Document with an XObject Image. When viewing in Adobe Reader, receiving 'An Error exists on this page. Acrobat may not display the page correctly...' It is not clear exactly what's wrong with the document and wanted to see if anyone had suggestions.
When I run PDF Repair Tool on www.pdf-online.com the following errors were reported.
The file is corrupt and cannot be repaired, but possibly recovered
Errors:
3-Heights(TM) PDF repair tool, evaluation license valid until unbounded
Open file.
Analyze Objects.
Analyze Outlines.
Analyze Pages.
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x00410518 - I - A path painting operator was used on an empty path.
- File: JDCPDF02_007 (1).PDF
0x8041050F - E - The name Im1 of a xobject resource is unknown.
- File: JDCPDF02_007 (1).PDF
0x80410113 - E - The file is corrupt and cannot be repaired. Some of the contents can possibly be recovered.
- Page No.: 1
- File: JDCPDF02_007 (1).PDF
Close file.
The PDF Document contains the following code.
% Producer:
% Created: 20220826084735
% Function:
% Creator:
% Author:
1 0 obj<< /Type /Catalog /Outlines 2 0 R /Pages 3 0 R>>endobj
2 0 obj<< /Type /Outlines /Count 0>>endobj
3 0 obj<< /Type /Pages /Kids [ 4 0 R] /Count 1>>endobj
4 0 obj<< /Type /Page /Parent 3 0 R /MediaBox [ 0 0 792 612 ] /Contents 5 0 R /Resources << /ProcSet 41 0 R /Font << /F1 7 0 R /F2 8 0 R /F3 9 0 R /F4 10 0 R /F5 11 0 R /F6 12 0 R /F7 13 0 R /F8 14 0 R /F9 15 0 R /F10 16 0 R /F11 17 0 R /F12 18 0 R /F13 19 0 R /F14 20 0 R /F15 21 0 R /F16 23 0 R /F17 25 0 R /F18 27 0 R /F19 29 0 R /F20 31 0 R /F21 33 0 R /F22 35 0 R /F23 37 0 R /F24 39 0 R>>>>>>endobj
5 0 obj<< /Length 28756 >>
stream
.
.
.
q 132 0 0 132 45 140 cm /Im1 Do Q
endstream
endobj
6 0 obj<</Type/XObject/Subtype/Image /Width 200 /Height 200 /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /ASCII85Decode /Length 48032>>
stream
.
.
.
endstream
endobj
41 0 obj<< /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] /XObject << /Image 6 0 R >> >>endobj
7 0 obj<< /Type /Font /Border [0 0 3] /Subtype /Type1 /Name /F1 /BaseFont /Courier /Encoding /MacRomanEncoding>>endobj
8 0 obj<< /Type /Font /Border [0 0 3] /Subtype /Type1 /Name /F2 /BaseFont /Courier-Oblique /Encoding /MacRomanEncoding>>endobj
9 0 obj<< /Type /Font /Border [0 0 3] /Subtype /Type1 /Name /F3 /BaseFont /Courier-Bold /Encoding /MacRomanEncoding>>endobj
10 0 obj<< /Type /Font /Border [0 0 3] /Subtype /Type1 /Name /F4 /BaseFont /Courier-BoldOblique /Encoding /MacRomanEncoding>>endobj
11 0 obj<< /Type /Font /Border [0 0 3] /Subtype /Type1 /Name /F5 /BaseFont /Helvetica /Encoding /MacRomanEncoding>>endobj
12 0 obj<< /Type /Font /Border [0 0 3] /Subtype /Type1 /Name /F6 /BaseFont /Helvetica-Oblique /Encoding /MacRomanEncoding>>endobj
13 0 obj<< /Type /Font /Border [0 0 3] /Subtype /Type1 /Name /F7 /BaseFont /Helvetica-Bold /Encoding /MacRomanEncoding>>endobj
14 0 obj<< /Type /Font /Border [0 0 3] /Subtype /Type1 /Name /F8 /BaseFont /Helvetica-BoldOblique /Encoding /MacRomanEncoding>>endobj
15 0 obj<< /Type /Font /Border [0 0 3] /Subtype /Type1 /Name /F9 /BaseFont /Times-Roman /Encoding /MacRomanEncoding>>endobj
16 0 obj<< /Type /Font /Border [0 0 3] /Subtype /Type1 /Name /F10 /BaseFont /Times-Italic /Encoding /MacRomanEncoding>>endobj
17 0 obj<< /Type /Font /Border [0 0 3] /Subtype /Type1 /Name /F11 /BaseFont /Times-Bold /Encoding /MacRomanEncoding>>endobj
18 0 obj<< /Type /Font /Border [0 0 3] /Subtype /Type1 /Name /F12 /BaseFont /Times-BoldItalic /Encoding /MacRomanEncoding>>endobj
19 0 obj<< /Type /Font /Border [0 0 3] /Subtype /Type1 /Name /F13 /BaseFont /Symbol>>endobj
20 0 obj<< /Type /Font /Border [0 0 3] /Subtype /Type1 /Name /F14 /BaseFont /ZapfDingbats>>endobj
21 0 obj<</Type /Font /BaseFont /Helvetica /Name /F15 /Subtype /TrueType /Encoding /WinAnsiEncoding /FontDescriptor 22 0 R /FirstChar 32 /LastChar 255 /Widths [ 288 288 360 552 552 888 672 192 336 336 384 576 288 336 288 288 552 552 552 552 552 552 552 552 552 552 288 288 576 576 576 552 1008 672 672 720 720 672 600 768 720 288 504 672 552 840 720 768 672 768 720 672 600 720 672 936 672 672 600 288 288 288 456 552 336 552 552 504 552 552 288 552 552 216 216 504 216 840 552 552 552 552 336 504 288 552 504 720 504 504 504 336 264 336 576 696 552 288 216 552 336 1008 552 552 336 1008 672 336 1008 288 288 288 288 216 216 336 336 600 552 1008 336 1008 504 336 936 288 288 672 288 336 552 552 552 552 264 552 336 744 360 552 576 336 744 552 408 552 336 336 336 576 528 288 336 336 360 552 840 840 840 600 672 672 672 672 672 672 1008 720 672 672 672 672 288 288 288 288 720 720 768 768 768 768 768 576 768 720 720 720 720 672 672 600 552 552 552 552 552 552 888 504 552 552 552 552 288 288 288 288 552 552 552 552 552 552 552 552 600 552 552 552 552 504 552 504 ]>>endobj
22 0 obj<</Type /FontDescriptor /FontName /Helvetica /Ascent 720 /Descent -204 /CapHeight 720 /StemV 80 /ItalicAngle 0 /MissingWidth 24 /XHeight 540 /FontBBox [0 -300 1000 700] /Flags 32>>endobj
23 0 obj<</Type /Font /BaseFont /Helvetica /Name /F16 /Subtype /TrueType /Encoding /WinAnsiEncoding /FontDescriptor 24 0 R /FirstChar 32 /LastChar 255 /Widths [ 288 288 360 552 552 888 672 192 336 336 384 576 288 336 288 288 552 552 552 552 552 552 552 552 552 552 288 288 576 576 576 552 1008 672 672 720 720 672 600 768 720 288 504 672 552 840 720 768 672 768 720 672 600 720 672 936 672 672 600 288 288 288 456 552 336 552 552 504 552 552 288 552 552 216 216 504 216 840 552 552 552 552 336 504 288 552 504 720 504 504 504 336 264 336 576 696 552 288 216 552 336 1008 552 552 336 1008 672 336 1008 288 288 288 288 216 216 336 336 600 552 1008 336 1008 504 336 936 288 288 672 288 336 552 552 552 552 264 552 336 744 360 552 576 336 744 552 408 552 336 336 336 576 528 288 336 336 360 552 840 840 840 600 672 672 672 672 672 672 1008 720 672 672 672 672 288 288 288 288 720 720 768 768 768 768 768 576 768 720 720 720 720 672 672 600 552 552 552 552 552 552 888 504 552 552 552 552 288 288 288 288 552 552 552 552 552 552 552 552 600 552 552 552 552 504 552 504 ]>>endobj
24 0 obj<</Type /FontDescriptor /FontName /Helvetica /Ascent 720 /Descent -204 /CapHeight 720 /StemV 80 /ItalicAngle 0 /MissingWidth 24 /XHeight 540 /FontBBox [0 -300 1000 700] /Flags 32>>endobj
25 0 obj<</Type /Font /BaseFont /Helvetica /Name /F17 /Subtype /TrueType /Encoding /WinAnsiEncoding /FontDescriptor 26 0 R /FirstChar 32 /LastChar 255 /Widths [ 288 288 360 552 552 888 672 192 336 336 384 576 288 336 288 288 552 552 552 552 552 552 552 552 552 552 288 288 576 576 576 552 1008 672 672 720 720 672 600 768 720 288 504 672 552 840 720 768 672 768 720 672 600 720 672 936 672 672 600 288 288 288 456 552 336 552 552 504 552 552 288 552 552 216 216 504 216 840 552 552 552 552 336 504 288 552 504 720 504 504 504 336 264 336 576 696 552 288 216 552 336 1008 552 552 336 1008 672 336 1008 288 288 288 288 216 216 336 336 600 552 1008 336 1008 504 336 936 288 288 672 288 336 552 552 552 552 264 552 336 744 360 552 576 336 744 552 408 552 336 336 336 576 528 288 336 336 360 552 840 840 840 600 672 672 672 672 672 672 1008 720 672 672 672 672 288 288 288 288 720 720 768 768 768 768 768 576 768 720 720 720 720 672 672 600 552 552 552 552 552 552 888 504 552 552 552 552 288 288 288 288 552 552 552 552 552 552 552 552 600 552 552 552 552 504 552 504 ]>>endobj
26 0 obj<</Type /FontDescriptor /FontName /Helvetica /Ascent 720 /Descent -204 /CapHeight 720 /StemV 80 /ItalicAngle 0 /MissingWidth 24 /XHeight 540 /FontBBox [0 -300 1000 700] /Flags 32>>endobj
27 0 obj<</Type /Font /BaseFont /Helvetica /Name /F18 /Subtype /TrueType /Encoding /WinAnsiEncoding /FontDescriptor 28 0 R /FirstChar 32 /LastChar 255 /Widths [ 288 288 360 552 552 888 672 192 336 336 384 576 288 336 288 288 552 552 552 552 552 552 552 552 552 552 288 288 576 576 576 552 1008 672 672 720 720 672 600 768 720 288 504 672 552 840 720 768 672 768 720 672 600 720 672 936 672 672 600 288 288 288 456 552 336 552 552 504 552 552 288 552 552 216 216 504 216 840 552 552 552 552 336 504 288 552 504 720 504 504 504 336 264 336 576 696 552 288 216 552 336 1008 552 552 336 1008 672 336 1008 288 288 288 288 216 216 336 336 600 552 1008 336 1008 504 336 936 288 288 672 288 336 552 552 552 552 264 552 336 744 360 552 576 336 744 552 408 552 336 336 336 576 528 288 336 336 360 552 840 840 840 600 672 672 672 672 672 672 1008 720 672 672 672 672 288 288 288 288 720 720 768 768 768 768 768 576 768 720 720 720 720 672 672 600 552 552 552 552 552 552 888 504 552 552 552 552 288 288 288 288 552 552 552 552 552 552 552 552 600 552 552 552 552 504 552 504 ]>>endobj
28 0 obj<</Type /FontDescriptor /FontName /Helvetica /Ascent 720 /Descent -204 /CapHeight 720 /StemV 80 /ItalicAngle 0 /MissingWidth 24 /XHeight 540 /FontBBox [0 -300 1000 700] /Flags 32>>endobj
29 0 obj<</Type /Font /BaseFont /Arial /Name /F19 /Subtype /TrueType /Encoding /WinAnsiEncoding /FontDescriptor 30 0 R /FirstChar 32 /LastChar 255 /Widths [ 280 280 360 560 560 893 667 187 333 333 387 587 280 333 280 280 560 560 560 560 560 560 560 560 560 560 280 280 587 587 587 560 1013 667 667 720 720 667 613 773 720 280 493 667 560 827 720 773 667 773 720 667 613 720 667 947 667 667 613 280 280 280 467 560 333 560 560 493 560 560 280 560 560 227 227 493 227 827 560 560 560 560 333 493 280 560 493 720 493 493 493 333 253 333 587 707 560 280 227 560 333 1000 560 560 333 1000 667 333 1000 280 280 280 280 227 227 333 333 600 560 1000 333 1000 493 333 947 280 280 667 280 333 560 560 560 560 253 560 333 733 373 560 587 333 733 547 400 547 333 333 333 573 533 280 333 333 360 560 840 840 840 613 667 667 667 667 667 667 1000 720 667 667 667 667 280 280 280 280 720 720 773 773 773 773 773 587 773 720 720 720 720 667 667 613 560 560 560 560 560 560 893 493 560 560 560 560 280 280 280 280 560 560 560 560 560 560 560 547 613 560 560 560 560 493 560 493 ]>>endobj
30 0 obj<</Type /FontDescriptor /FontName /Arial /Ascent 733 /Descent -213 /CapHeight 733 /StemV 80 /ItalicAngle 0 /MissingWidth 21 /XHeight 549 /FontBBox [0 -300 1000 700] /Flags 32>>endobj
31 0 obj<</Type /Font /BaseFont /Times-Roman /Name /F20 /Subtype /TrueType /Encoding /WinAnsiEncoding /FontDescriptor 32 0 R /FirstChar 32 /LastChar 255 /Widths [ 253 333 413 493 493 827 773 187 333 333 493 560 253 333 253 280 493 493 493 493 493 493 493 493 493 493 280 280 560 560 560 440 920 720 667 667 720 613 560 720 720 333 387 720 613 893 720 720 560 720 667 560 613 720 720 947 720 720 613 333 280 333 467 493 333 440 493 440 493 440 333 493 493 280 280 493 280 773 493 493 493 493 333 387 280 493 493 720 493 493 440 480 200 480 547 707 493 253 333 493 440 1000 493 493 333 1000 560 333 893 253 253 253 253 333 333 440 440 600 493 1000 333 973 387 333 720 253 253 720 253 333 493 493 493 493 200 493 333 760 280 493 560 333 760 493 400 547 293 293 333 573 453 253 333 293 307 493 747 747 747 440 720 720 720 720 720 720 893 667 613 613 613 613 333 333 333 333 720 720 720 720 720 720 720 560 720 720 720 720 720 720 560 493 440 440 440 440 440 440 667 440 440 440 440 440 280 280 280 280 493 493 493 493 493 493 493 547 493 493 493 493 493 493 493 493 ]>>endobj
32 0 obj<</Type /FontDescriptor /FontName /Times-Roman /Ascent 693 /Descent -213 /CapHeight 693 /StemV 80 /ItalicAngle 0 /MissingWidth 19 /XHeight 519 /FontBBox [0 -300 1000 700] /Flags 34>>endobj
33 0 obj<</Type /Font /BaseFont /Times-Bold /Name /F21 /Subtype /TrueType /Encoding /WinAnsiEncoding /FontDescriptor 34 0 R /FirstChar 32 /LastChar 255 /Widths [ 253 333 560 493 493 1000 827 280 333 333 493 573 253 333 253 280 493 493 493 493 493 493 493 493 493 493 333 333 573 573 573 493 933 720 667 720 720 667 613 773 773 387 493 773 667 947 720 773 613 773 720 560 667 720 720 1000 720 720 667 333 280 333 587 493 333 493 560 440 560 440 333 493 560 280 333 560 280 827 560 493 560 560 440 387 333 560 493 720 493 493 440 400 227 400 520 707 493 253 333 493 493 1000 493 493 333 1000 560 333 1000 253 253 253 253 333 333 493 493 600 493 1000 333 1000 387 333 720 253 253 720 253 333 493 493 493 493 227 493 333 747 293 493 573 333 747 493 400 547 293 293 333 573 533 253 333 293 333 493 747 747 747 493 720 720 720 720 720 720 1000 720 667 667 667 667 387 387 387 387 720 720 773 773 773 773 773 573 773 720 720 720 720 720 613 560 493 493 493 493 493 493 720 440 440 440 440 440 280 280 280 280 493 560 493 493 493 493 493 547 493 560 560 560 560 493 560 493 ]>>endobj
34 0 obj<</Type /FontDescriptor /FontName /Times-Bold /Ascent 680 /Descent -213 /CapHeight 680 /StemV 80 /ItalicAngle 0 /MissingWidth 19 /XHeight 510 /FontBBox [0 -300 1000 700] /Flags 262178 /FontWeight 700>>endobj
35 0 obj<</Type /Font /BaseFont /Times-Italic /Name /F22 /Subtype /TrueType /Encoding /WinAnsiEncoding /FontDescriptor 36 0 R /FirstChar 32 /LastChar 255 /Widths [ 253 333 413 493 493 827 773 213 333 333 493 680 253 333 253 280 493 493 493 493 493 493 493 493 493 493 333 333 680 680 680 493 920 613 613 667 720 613 613 720 720 333 440 667 560 827 667 720 613 720 613 493 560 720 613 827 613 560 560 387 280 387 427 493 333 493 493 440 493 440 280 493 493 280 280 440 280 720 493 493 493 493 387 387 280 493 440 667 440 440 387 400 280 400 547 707 493 253 333 493 560 893 493 493 333 1000 493 333 947 253 253 253 253 333 333 560 560 600 493 893 333 973 387 333 667 253 253 560 253 387 493 493 493 493 280 493 333 760 280 493 680 333 760 493 400 547 293 293 333 573 520 253 333 293 307 493 747 747 747 493 613 613 613 613 613 613 893 667 613 613 613 613 333 333 333 333 720 667 720 720 720 720 720 680 720 720 720 720 720 560 613 493 493 493 493 493 493 493 667 440 440 440 440 440 280 280 280 280 493 493 493 493 493 493 493 547 493 493 493 493 493 440 493 440 ]>>endobj
36 0 obj<</Type /FontDescriptor /FontName /Times-Italic /Ascent 693 /Descent -213 /CapHeight 693 /StemV 80 /ItalicAngle -15 /MissingWidth 19 /XHeight 519 /FontBBox [0 -300 1000 700] /Flags 98>>endobj
37 0 obj<</Type /Font /BaseFont /Times-BoldItalic /Name /F23 /Subtype /TrueType /Encoding /WinAnsiEncoding /FontDescriptor 38 0 R /FirstChar 32 /LastChar 255 /Widths [ 253 387 560 493 493 827 773 280 333 333 493 573 253 333 253 280 493 493 493 493 493 493 493 493 493 493 333 333 573 573 573 493 827 667 667 667 720 667 667 720 773 387 493 667 613 893 720 720 613 720 667 560 613 720 667 893 667 613 613 333 280 333 573 493 333 493 493 440 493 440 333 493 560 280 280 493 280 773 560 493 493 493 387 387 280 560 440 667 493 440 387 347 227 347 573 707 493 253 333 493 493 1000 493 493 333 1000 560 333 947 253 253 253 253 333 333 493 493 600 493 1000 333 1000 387 333 720 253 253 613 253 387 493 493 493 493 227 493 333 747 267 493 600 333 747 493 400 547 293 293 333 573 493 253 333 293 293 493 747 747 747 493 667 667 667 667 667 667 947 667 667 667 667 667 387 387 387 387 720 720 720 720 720 720 720 573 720 720 720 720 720 613 613 493 493 493 493 493 493 493 720 440 440 440 440 440 280 280 280 280 493 560 493 493 493 493 493 547 493 560 560 560 560 440 493 440 ]>>endobj
38 0 obj<</Type /FontDescriptor /FontName /Times-BoldItalic /Ascent 680 /Descent -213 /CapHeight 680 /StemV 80 /ItalicAngle -15 /MissingWidth 19 /XHeight 510 /FontBBox [0 -300 1000 700] /Flags 262242 /FontWeight 700>>endobj
39 0 obj<</Type /Font /BaseFont /MICR /Name /F24 /Subtype /TrueType /Encoding /WinAnsiEncoding /FontDescriptor 40 0 R /FirstChar 32 /LastChar 255 /Widths [ 253 387 560 493 493 827 773 280 333 333 493 573 253 333 253 280 493 493 493 493 493 493 493 493 493 493 333 333 573 573 573 493 827 667 667 667 720 667 667 720 773 387 493 667 613 893 720 720 613 720 667 560 613 720 667 893 667 613 613 333 280 333 573 493 333 493 493 440 493 440 333 493 560 280 280 493 280 773 560 493 493 493 387 387 280 560 440 667 493 440 387 347 227 347 573 707 493 253 333 493 493 1000 493 493 333 1000 560 333 947 253 253 253 253 333 333 493 493 600 493 1000 333 1000 387 333 720 253 253 613 253 387 493 493 493 493 227 493 333 747 267 493 600 333 747 493 400 547 293 293 333 573 493 253 333 293 293 493 747 747 747 493 667 667 667 667 667 667 947 667 667 667 667 667 387 387 387 387 720 720 720 720 720 720 720 573 720 720 720 720 720 613 613 493 493 493 493 493 493 493 720 440 440 440 440 440 280 280 280 280 493 560 493 493 493 493 493 547 493 560 560 560 560 440 493 440 ]>>endobj
40 0 obj<</Type /FontDescriptor /FontName /Times-Roman /Ascent 693 /Descent -213 /CapHeight 693 /StemV 80 /ItalicAngle 0 /MissingWidth 19 /XHeight 519 /FontBBox [0 -300 1000 700] /Flags 34>>endobj
42 0 obj<</Producer(FIS AddVantage Version 2021A)/CreationDate(D:20220826084736)/ModDate(D:20220826084736)/Title(VPI Function EPM Enter Programmers Mode)/Creator(FIS AddVantage Version 2021A User: E1073008)/Author(NCSINT FIS Trust & Custody)>>endobj
xref
0 43
0000000000 65535 f
0000000099 00000 n
0000000162 00000 n
0000000206 00000 n
0000000262 00000 n
0000000668 00000 n
0000029479 00000 n
0000077773 00000 n
0000077893 00000 n
0000078021 00000 n
0000078146 00000 n
0000078279 00000 n
0000078402 00000 n
0000078533 00000 n
0000078661 00000 n
0000078796 00000 n
0000078921 00000 n
0000079048 00000 n
0000079173 00000 n
0000079304 00000 n
0000079397 00000 n
0000079496 00000 n
0000080571 00000 n
0000080767 00000 n
0000081842 00000 n
0000082038 00000 n
0000083113 00000 n
0000083309 00000 n
0000084384 00000 n
0000084580 00000 n
0000085651 00000 n
0000085843 00000 n
0000086916 00000 n
0000087114 00000 n
0000088191 00000 n
0000088408 00000 n
0000089480 00000 n
0000089681 00000 n
0000090760 00000 n
0000090985 00000 n
0000092052 00000 n
0000077678 00000 n
0000092250 00000 n
trailer << /Size 44 /Root 1 0 R /Info 42 0 R >>
startxref
92501
%%EOF```
The /Im1 form needs to be declared in XObject sub-dictionary in the Pages Resources. For example:
4 0 obj
<<
/Type /Page
/Contents 5 0 R
/MediaBox [ 0 0 792 612 ]
/Parent 3 0 R
/Resources <<
/Font <<
/F1 7 0 R
% etc...
/F9 15 0 R
>>
/XObject <<
/Im1 6 0 R
>>
/ProcSet 41 0 R
>>
>>
endobj
Not that well explained in the PDF IOS-32000 Specification, but mentioned in Table 33 - Entries in a resource dictionary.
Also note that your PDF should really start with %PDF-x.y e.g. `%PDF-1.4'.

Pick numbers from an array and see if they are even and lower than 380

I'm programing a bash to pick all numbers from a list and print all even and lower than 380.
This is what i have so far, but i get error on if...
Any help is welcome.
n=(951 402 984 651 360 69 408 319 601 485 980 507 725 547 544 615 141 501 263 617 865 575 219 390 237 412 566 826 248 866 950 626 949 687 217 815 67 104 58 512 24 892 894 767 553)
for (( i=0; i<${#n[#]}; i++ ))
do
b=${n[$i]}
rem=$(( $b % 2 ))
if (( $rem == 0 && b < 380 ))
then
echo "$b Par"
else
continue
fi
done

Why am I getting numbers larger than 1000 when I %1000 a number generated by 64 bit mersenne twister engine?

I'm trying to generate a zobrist key for transposition tables in my chess engine.
Here's how I'm generating the 64 bit numbers,
as show here: How to generate 64 bit random numbers?
typedef unsigned long long U64;
std::random_device rd;
std::mt19937_64 mt(rd());
std::uniform_int_distribution<U64> dist(std::llround(std::pow(2,61)),
std::llround(std::pow(2,62)));
rand function:
U64 ZobristH::random64()
{
U64 ranUI = dist(mt);
return ranUI;
}
In order to try and make sure i'm generating random enough numbers I'm using a test distribution function I found online that looks like this (will later input data into excel and look at distribution):
int sampleSize = 2000;
int distArray[sampleSize];
int t = 0;
while (t < 10)
{
for (int i = 0; i < 10000; i++)
{
distArray[(int)(random64() % (sampleSize / 2))]++;
}
t++;
}
for (int i = 0; i < sampleSize; i++)
{
std::cout << distArray[i] << ", ";
}
the results I'm getting look a little something like this:
416763345, 417123246, 7913280, 7914356, 417726722, 417726718, 19, 83886102,
77332499, 14
Are these the decimal representation of binary numbers below 1000? Or am I doing something completely wrong?
Okay I did this to check out the distribution of random numbers; you can run this short program to generate a text file to look to see what values you are getting. Instead of using a function call I just used a lambda within the for loop and instead of setting the values into the array I wrote the values out to the text file before and after the post increment.
#include <iostream>
#include <fstream>
#include <iomanip>
#include <random>
#include <functional> // may not need - included in almost all of my apps
#include <algorithm> // same as above
typedef unsigned long long U64;
int main( int argc, char** argv ) {
std::random_device rd;
std::mt19937_64 mt( rd() );
std::uniform_int_distribution<U64> dist( std::llround( std::pow( 2, 61 ) ),
std::llround( std::pow( 2, 62 ) ) );
auto lambda = [&] { return dist(mt); };
const int sampleSize = 2000;
// int distArray[sampleSize];
int t = 0;
std::ofstream file( "samples.txt" );
while ( t < 10 ) {
file << "Sample: " << (t+1) << "\n";
for ( int i = 0; i < 10000; i++ ) {
auto val = static_cast<int>( (lambda() % (sampleSize / 2)) );
file << std::setw(5) << i << ": " << std::setw(6) << val << "\t"
<< std::setw(6) << val++ << "\n";
// distArray[...]
}
file << "\n\n";
t++;
}
file.close();
/* for ( int i = 0; i < sampleSize; i++ ) {
std::cout << distArray[i] << "\n";
}*/
// Quick & Dirty Way TO Pause The Console
std::cout << "\nPress any key and enter to quit.\n";
char c;
std::cin >> c;
return 0;
}
Then check out the text file that this program generates and if you scroll through the file you will see the distributions. The first column is the value before the post increment and the second column is after. The largest possible value before the post increment that I have seen is 1,000 and after the post increment is 999. I've built and ran this for both 32 & 64 bit platform versions and have seen similar results for the distributions and that they indeed have a uniform distribution.
Sample.txt - Small Version About 1,000 Entries Out The 1st Sample Set
Sample: 1
0: 342 341
1: 517 516
2: 402 401
3: 741 740
4: 238 237
5: 557 556
6: 35 34
7: 572 571
8: 205 204
9: 353 352
10: 301 300
11: 65 64
12: 223 222
13: 647 646
14: 185 184
15: 535 534
16: 97 96
17: 843 842
18: 716 715
19: 294 293
20: 485 484
21: 648 647
22: 406 405
23: 250 249
24: 245 244
25: 915 914
26: 888 887
27: 986 985
28: 345 344
29: 493 492
30: 654 653
31: 860 859
32: 921 920
33: 526 525
34: 793 792
35: 503 502
36: 939 938
37: 802 801
38: 142 141
39: 806 805
40: 540 539
41: 778 777
42: 787 786
43: 884 883
44: 109 108
45: 842 841
46: 794 793
47: 279 278
48: 821 820
49: 112 111
50: 438 437
51: 402 401
52: 69 68
53: 396 395
54: 196 195
55: 655 654
56: 859 858
57: 674 673
58: 417 416
59: 331 330
60: 632 631
61: 210 209
62: 641 640
63: 737 736
64: 838 837
65: 592 591
66: 562 561
67: 883 882
68: 750 749
69: 726 725
70: 253 252
71: 660 659
72: 57 56
73: 401 400
74: 919 918
75: 851 850
76: 345 344
77: 25 24
78: 300 299
79: 781 780
80: 695 694
81: 220 219
82: 378 377
83: 471 470
84: 281 280
85: 945 944
86: 536 535
87: 407 406
88: 431 430
89: 745 744
90: 32 31
91: 389 388
92: 358 357
93: 582 581
94: 820 819
95: 622 621
96: 459 458
97: 233 232
98: 594 593
99: 509 508
100: 260 259
101: 152 151
102: 148 147
103: 137 136
104: 945 944
105: 244 243
106: 968 967
107: 54 53
108: 420 419
109: 58 57
110: 678 677
111: 715 714
112: 780 779
113: 834 833
114: 241 240
115: 669 668
116: 722 721
117: 608 607
118: 805 804
119: 155 154
120: 220 219
121: 520 519
122: 740 739
123: 184 183
124: 198 197
125: 247 246
126: 115 114
127: 520 519
128: 457 456
129: 864 863
130: 659 658
131: 511 510
132: 718 717
133: 119 118
134: 588 587
135: 113 112
136: 518 517
137: 164 163
138: 375 374
139: 866 865
140: 382 381
141: 526 525
142: 621 620
143: 680 679
144: 147 146
145: 712 711
146: 408 407
147: 486 485
148: 7 6
149: 203 202
150: 741 740
151: 290 289
152: 810 809
153: 960 959
154: 449 448
155: 683 682
156: 997 996
157: 454 453
158: 131 130
159: 427 426
160: 157 156
161: 3 2
162: 427 426
163: 554 553
164: 806 805
165: 228 227
166: 431 430
167: 174 173
168: 845 844
169: 121 120
170: 397 396
171: 770 769
172: 17 16
173: 761 760
174: 736 735
175: 629 628
176: 772 771
177: 417 416
178: 739 738
179: 226 225
180: 301 300
181: 217 216
182: 746 745
183: 344 343
184: 607 606
185: 927 926
186: 428 427
187: 385 384
188: 287 286
189: 537 536
190: 705 704
191: 649 648
192: 127 126
193: 252 251
194: 160 159
195: 390 389
196: 282 281
197: 66 65
198: 659 658
199: 844 843
200: 358 357
201: 360 359
202: 872 871
203: 495 494
204: 695 694
205: 988 987
206: 969 968
207: 641 640
208: 799 798
209: 30 29
210: 109 108
211: 675 674
212: 345 344
213: 309 308
214: 807 806
215: 283 282
216: 457 456
217: 193 192
218: 972 971
219: 330 329
220: 914 913
221: 508 507
222: 624 623
223: 254 253
224: 342 341
225: 69 68
226: 918 917
227: 551 550
228: 148 147
229: 645 644
230: 905 904
231: 503 502
232: 980 979
233: 881 880
234: 137 136
235: 202 201
236: 808 807
237: 988 987
238: 497 496
239: 506 505
240: 576 575
241: 671 670
242: 874 873
243: 217 216
244: 808 807
245: 741 740
246: 14 13
247: 206 205
248: 894 893
249: 180 179
250: 4 3
251: 27 26
252: 62 61
253: 203 202
254: 392 391
255: 868 867
256: 673 672
257: 881 880
258: 664 663
259: 831 830
260: 293 292
261: 916 915
262: 860 859
263: 487 486
264: 642 641
265: 161 160
266: 881 880
267: 233 232
268: 423 422
269: 12 11
270: 398 397
271: 993 992
272: 323 322
273: 878 877
274: 114 113
275: 42 41
276: 58 57
277: 398 397
278: 878 877
279: 64 63
280: 873 872
281: 841 840
282: 506 505
283: 412 411
284: 545 544
285: 887 886
286: 17 16
287: 504 503
288: 350 349
289: 772 771
290: 16 15
291: 597 596
292: 553 552
293: 25 24
294: 324 323
295: 242 241
296: 580 579
297: 479 478
298: 702 701
299: 640 639
300: 173 172
301: 918 917
302: 678 677
303: 714 713
304: 258 257
305: 97 96
306: 304 303
307: 80 79
308: 394 393
309: 940 939
310: 985 984
311: 651 650
312: 42 41
313: 179 178
314: 672 671
315: 915 914
316: 160 159
317: 332 331
318: 887 886
319: 370 369
320: 850 849
321: 730 729
322: 395 394
323: 889 888
324: 114 113
325: 505 504
326: 381 380
327: 578 577
328: 762 761
329: 896 895
330: 793 792
331: 295 294
332: 488 487
333: 599 598
334: 182 181
335: 25 24
336: 623 622
337: 396 395
338: 898 897
339: 981 980
340: 645 644
341: 806 805
342: 205 204
343: 404 403
344: 234 233
345: 36 35
346: 659 658
347: 285 284
348: 62 61
349: 608 607
350: 632 631
351: 825 824
352: 585 584
353: 685 684
354: 14 13
355: 828 827
356: 720 719
357: 871 870
358: 88 87
359: 716 715
360: 879 878
361: 650 649
362: 464 463
363: 898 897
364: 930 929
365: 194 193
366: 997 996
367: 105 104
368: 776 775
369: 398 397
370: 962 961
371: 434 433
372: 954 953
373: 548 547
374: 989 988
375: 943 942
376: 229 228
377: 866 865
378: 554 553
379: 567 566
380: 379 378
381: 564 563
382: 738 737
383: 468 467
384: 660 659
385: 693 692
386: 784 783
387: 739 738
388: 662 661
389: 474 473
390: 545 544
391: 958 957
392: 703 702
393: 316 315
394: 571 570
395: 95 94
396: 497 496
397: 672 671
398: 676 675
399: 821 820
400: 368 367
401: 7 6
402: 817 816
403: 221 220
404: 839 838
405: 578 577
406: 635 634
407: 453 452
408: 70 69
409: 764 763
410: 78 77
411: 968 967
412: 295 294
413: 483 482
414: 392 391
415: 23 22
416: 389 388
417: 678 677
418: 150 149
419: 863 862
420: 677 676
421: 676 675
422: 455 454
423: 405 404
424: 126 125
425: 753 752
426: 821 820
427: 328 327
428: 773 772
429: 596 595
430: 645 644
431: 829 828
432: 377 376
433: 444 443
434: 813 812
435: 395 394
436: 794 793
437: 641 640
438: 98 97
439: 827 826
440: 824 823
441: 681 680
442: 736 735
443: 288 287
444: 560 559
445: 781 780
446: 556 555
447: 327 326
448: 820 819
449: 859 858
450: 686 685
451: 919 918
452: 267 266
453: 128 127
454: 583 582
455: 446 445
456: 783 782
457: 712 711
458: 378 377
459: 367 366
460: 52 51
461: 316 315
462: 780 779
463: 398 397
464: 435 434
465: 788 787
466: 380 379
467: 235 234
468: 748 747
469: 429 428
470: 91 90
471: 675 674
472: 853 852
473: 674 673
474: 277 276
475: 179 178
476: 264 263
477: 511 510
478: 514 513
479: 979 978
480: 845 844
481: 728 727
482: 904 903
483: 874 873
484: 750 749
485: 659 658
486: 376 375
487: 713 712
488: 393 392
489: 538 537
490: 896 895
491: 879 878
492: 347 346
493: 819 818
494: 210 209
495: 707 706
496: 869 868
497: 319 318
498: 832 831
499: 498 497
500: 71 70
501: 290 289
502: 861 860
503: 295 294
504: 888 887
505: 515 514
506: 222 221
507: 661 660
508: 813 812
509: 969 968
510: 547 546
511: 900 899
512: 58 57
513: 805 804
514: 428 427
515: 453 452
516: 23 22
517: 969 968
518: 718 717
519: 775 774
520: 395 394
521: 521 520
522: 522 521
523: 465 464
524: 317 316
525: 216 215
526: 254 253
527: 696 695
528: 677 676
529: 21 20
530: 318 317
531: 301 300
532: 142 141
533: 877 876
534: 486 485
535: 981 980
536: 516 515
537: 254 253
538: 328 327
539: 385 384
540: 2 1
541: 405 404
542: 387 386
543: 794 793
544: 48 47
545: 641 640
546: 814 813
547: 981 980
548: 354 353
549: 281 280
550: 561 560
551: 683 682
552: 247 246
553: 739 738
554: 370 369
555: 799 798
556: 680 679
557: 915 914
558: 638 637
559: 254 253
560: 705 704
561: 320 319
562: 640 639
563: 487 486
564: 47 46
565: 852 851
566: 749 748
567: 419 418
568: 300 299
569: 507 506
570: 141 140
571: 972 971
572: 895 894
573: 988 987
574: 279 278
575: 268 267
576: 392 391
577: 530 529
578: 679 678
579: 855 854
580: 246 245
581: 645 644
582: 624 623
583: 417 416
584: 203 202
585: 30 29
586: 9 8
587: 585 584
588: 573 572
589: 471 470
590: 504 503
591: 290 289
592: 588 587
593: 230 229
594: 351 350
595: 651 650
596: 615 614
597: 502 501
598: 352 351
599: 472 471
// 600 - 699 omitted to make space to fit answer
700: 247 246
701: 894 893
702: 809 808
703: 382 381
704: 81 80
705: 574 573
706: 507 506
707: 508 507
708: 569 568
709: 947 946
710: 384 383
711: 14 13
712: 627 626
713: 951 950
714: 825 824
715: 657 656
716: 206 205
717: 598 597
718: 300 299
719: 266 265
720: 909 908
721: 206 205
722: 126 125
723: 841 840
724: 586 585
725: 348 347
726: 100 99
727: 361 360
728: 695 694
729: 556 555
730: 66 65
731: 5 4
732: 686 685
733: 488 487
734: 149 148
735: 622 621
736: 476 475
737: 488 487
738: 371 370
739: 331 330
740: 965 964
741: 141 140
742: 396 395
743: 917 916
744: 31 30
745: 924 923
746: 283 282
747: 369 368
748: 519 518
749: 830 829
750: 688 687
751: 374 373
752: 41 40
753: 418 417
754: 766 765
755: 854 853
756: 453 452
757: 521 520
758: 640 639
759: 185 184
760: 41 40
761: 125 124
762: 723 722
763: 341 340
764: 142 141
765: 754 753
766: 459 458
767: 899 898
768: 166 165
769: 374 373
770: 572 571
771: 304 303
772: 352 351
773: 235 234
774: 879 878
775: 736 735
776: 576 575
777: 56 55
778: 102 101
779: 170 169
780: 208 207
781: 135 134
782: 919 918
783: 599 598
784: 37 36
785: 997 996
786: 922 921
787: 502 501
788: 29 28
789: 173 172
790: 54 53
791: 601 600
792: 535 534
793: 64 63
794: 723 722
795: 491 490
796: 685 684
797: 58 57
798: 272 271
799: 261 260
800: 81 80
801: 149 148
802: 129 128
803: 712 711
804: 377 376
805: 151 150
806: 514 513
807: 14 13
808: 838 837
809: 347 346
810: 517 516
811: 442 441
812: 264 263
813: 883 882
814: 447 446
815: 140 139
816: 195 194
817: 841 840
818: 218 217
819: 858 857
820: 28 27
821: 222 221
822: 223 222
823: 906 905
824: 873 872
825: 492 491
826: 826 825
827: 738 737
828: 307 306
829: 185 184
830: 525 524
831: 449 448
832: 646 645
833: 686 685
834: 942 941
835: 433 432
836: 881 880
837: 824 823
838: 641 640
839: 290 289
840: 897 896
841: 4 3
842: 124 123
843: 679 678
844: 524 523
845: 424 423
846: 282 281
847: 625 624
848: 414 413
849: 647 646
850: 129 128
851: 395 394
852: 720 719
853: 318 317
854: 262 261
855: 402 401
856: 413 412
857: 139 138
858: 549 548
859: 472 471
860: 162 161
861: 605 604
862: 67 66
863: 980 979
864: 465 464
865: 912 911
866: 219 218
867: 648 647
868: 619 618
869: 331 330
870: 625 624
871: 360 359
872: 425 424
873: 935 934
874: 89 88
875: 641 640
876: 535 534
877: 404 403
878: 966 965
879: 27 26
880: 281 280
881: 637 636
882: 57 56
883: 152 151
884: 156 155
885: 813 812
886: 340 339
887: 181 180
888: 921 920
889: 306 305
890: 101 100
891: 178 177
892: 417 416
893: 845 844
894: 904 903
895: 295 294
896: 346 345
897: 654 653
898: 357 356
899: 929 928
900: 195 194
901: 499 498
902: 377 376
903: 727 726
904: 570 569
905: 853 852
906: 71 70
907: 580 579
908: 642 641
909: 889 888
910: 559 558
911: 134 133
912: 324 323
913: 120 119
914: 991 990
915: 6 5
916: 708 707
917: 347 346
918: 929 928
919: 454 453
920: 636 635
921: 218 217
922: 739 738
923: 715 714
924: 87 86
925: 782 781
926: 670 669
927: 845 844
928: 79 78
929: 730 729
930: 58 57
931: 216 215
932: 711 710
933: 898 897
934: 871 870
935: 388 387
936: 389 388
937: 944 943
938: 927 926
939: 88 87
940: 617 616
941: 940 939
942: 948 947
943: 927 926
944: 646 645
945: 125 124
946: 615 614
947: 846 845
948: 705 704
949: 998 997
950: 304 303
951: 346 345
952: 675 674
953: 783 782
954: 129 128
955: 69 68
956: 17 16
957: 646 645
958: 559 558
959: 62 61
960: 807 806
961: 571 570
962: 54 53
963: 297 296
964: 771 770
965: 972 971
966: 829 828
967: 786 785
968: 650 649
969: 101 100
970: 705 704
971: 690 689
972: 365 364
973: 304 303
974: 82 81
975: 776 775
976: 495 494
977: 586 585
978: 556 555
979: 77 76
980: 640 639
981: 161 160
982: 910 909
983: 46 45
984: 43 42
985: 162 161
986: 514 513
987: 654 653
988: 668 667
989: 126 125
990: 254 253
991: 133 132
992: 398 397
993: 993 992
994: 357 356
995: 298 297
996: 519 518
997: 904 903
998: 382 381
999: 28 27
1000: 19 18
1001: 939 938
1002: 868 867
1003: 888 887
1004: 576 575
1005: 183 182
1006: 174 173
1007: 679 678
1008: 831 830
1009: 464 463
1010: 876 875
1011: 738 737
1012: 447 446
1013: 385 384
1014: 271 270
1015: 38 37
1016: 28 27
1017: 451 450
1018: 162 161
1019: 847 846
1020: 430 429
1021: 849 848
1022: 207 206
1023: 196 195
1024: 42 41
1025: 709 708
1026: 557 556
1027: 173 172
1028: 788 787
1029: 160 159
1030: 535 534
1031: 555 554
1032: 252 251
1033: 111 110
1034: 476 475
1035: 780 779
1036: 44 43
1037: 190 189
1038: 443 442
1039: 655 654
1040: 7 6
1041: 845 844
1042: 856 855
1043: 274 273
1044: 933 932
1045: 336 335
1046: 185 184
1047: 580 579
1048: 807 806
1049: 286 285
1050: 409 408
1051: 347 346
1052: 461 460
1053: 624 623
1054: 378 377
1055: 903 902
1056: 483 482
1057: 838 837
1058: 809 808
1059: 919 918
1060: 544 543
1061: 458 457
1062: 121 120
1063: 192 191
1064: 126 125
1065: 843 842
1066: 927 926
1067: 390 389
1068: 567 566
1069: 1000 999
Entry 1069 is the first occurrence in this sample set to reach 1,000. I've ran this about a dozen times both in 32bit and 64bit modes and I did not see any value go above 1,000.
I'm not sure but I think that this line in your code is what is giving you your problem(s):
distArray[(int)(random64() % (sampleSize / 2))]++;

increasing range parsing challenge with awk

I wrote this in response to Reddit's daily programmer challenge, and I would like to get some of your feedback on it to improve the code (it seems to work). The challenge is as follows:
We are given a list of numbers in a "short-hand" range notation where only the significant part of the next number is written because we know the numbers are always increasing (ex. "1,3,7,2,4,1" represents [1, 3, 7, 12, 14, 21]). Some people use different separators for their ranges (ex. "1-3,1-2", "1:3,1:2", "1..3,1..2" represent the same numbers [1, 2, 3, 11, 12]) and they sometimes specify a third digit for the range step (ex. "1:5:2" represents [1, 3, 5]).
NOTE: For this challenge range limits are always inclusive.
Our job is to return a list of the complete numbers.
The possible separators are: ["-", ":", ".."]
Sample input:
104..02
545,64:11
Sample output:
104 105 106...200 201 202 # truncated for simplicity
545 564 565 566...609 610 611 # truncated for simplicity
My solution:
BEGIN { FS = "," }
function next_value(current_value, previous_value) {
regexp = current_value "$"
while(current_value <= previous_value || !(current_value ~ regexp)) {
current_value += 10
}
return current_value;
}
{
j = 0
delete number_list
for(i = 1; i <= NF; i++) {
# handle fields with ranges
if($i ~ /-|:|\.\./) {
split($i, range, /-|:|\.\./)
if(range[1] > range[2]) {
if(j != 0) {
range[1] = next_value(range[1], number_list[j-1])
range[2] = next_value(range[2], range[1])
}
else
range[2] = next_value(range[2], range[1]);
}
if(range[3] == "")
number_to_iterate_by = 1;
else
number_to_iterate_by = range[3];
range_iterator = range[1]
while(range_iterator <= range[2]) {
number_list[j] = range_iterator
range_iterator += number_to_iterate_by
j++
}
}
else {
number_list[j] = $i
j++
}
}
# apply increasing range logic and print
for(i = 0; i < j; i++ ) {
if(i == 0) {
if(NR != 1) printf "\n"
current_value = number_list[i]
}
else {
previous_value = current_value
current_value = next_value(number_list[i], previous_value)
}
printf "%s ", current_value
}
}
END { printf "\n" }
This is BASH (Not AWK).
I believe it is a valid answer because the original challenge doesn't specify a language.
#!/bin/bash
mkord(){ local v=$1 dig base
max=$2
(( dig=10**${#v} , base=max/dig*dig , v+=base ))
while (( v < max )); do (( v+=dig )); done
max=$v
}
while read line; do
line="${line//[,\"]/ }" line="${line//[:-]/..}"
IFS=' ' read -a arr <<<"$line"
max=0 a='' res=''
for val in "${arr[#]//../ }"; do
IFS=" " read v1 v2 v3 <<<"$val"
(( a==0 )) && max=$v1
[[ $v1 ]] && mkord "$v1" "$max" && v1=$max
[[ $v2 ]] && mkord "$v2" "$max" && v2=$max
res=$res${a:+,}${v2:+\{}$v1${v2:+\.\.}$v2${v3:+\.\.}$v3${v2:+\}}
a=1
done
(( ${#arr[#]} > 1 )) && res={$res}
eval set -- $res
echo "\"$*\""
done <"infile"
If the source of the tests is:
$ cat infile
"1,3,7,2,4,1"
"1-3,1-2"
"1:5:2"
"104-2"
"104..02"
"545,64:11"
The result will be:
"1 3 7 12 14 21"
"1 2 3 11 12"
"1 3 5"
"104 105 106 107 108 109 110 111 112"
"104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202"
"545 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611"
This gets the list done in 7 milliseconds.
My solution using gawk, RT (It contains the input text that matched the text denoted by RS) and next_n function uses modulo operation for to find the next number based on the last
cat range.awk
BEGIN{
RS="\\.\\.|,|:|-"
start = ""
end = 0
temp = ""
}
function next_n(n, last){
mod = last % (10**length(n))
if(mod < n) return last - mod + n
return last + ((10**length(n))-mod) + n
}
{
if(RT==":" || RT==".." || RT=="-"){
if(start=="") start = next_n($1,end)
else temp = $1
}else{
if(start != ""){
if(temp==""){
end = next_n($1,start)
step = 1
}else {
end = next_n(temp,start)
step = $1
}
for(i=start; i<=end; i+=step) printf "%s ", i
start = ""
temp = ""
}else{
end = next_n($1,end)
printf "%s ", end
}
}
}
END{
print ""
}
TEST 1
echo "104..02" | awk -f range.awk
OUTPUT 1
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
TEST 2
echo "545,64:11" | awk -f range.awk
OUTPUT 2
545 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611
TEST 3
echo "2..5,7,2-1,2:1,0-3,2-7,8..0,4,4,2..1" | awk -f range.awk
OUTPUT 3
2 3 4 5 7 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 40 41 42 43 52 53 54 55 56 57 58 59 60 64 74 82 83 84 85 86 87 88 89 90 91
TEST 4 with step
echo "1:5:2,99,88..7..3" | awk -f range.awk"
OUTPUT 4
1 3 5 99 188 191 194 197

Parsing the wbxml get from Exchange2013 server

Below is a full section of bytes stream I got from Exchange2013 server after sending activesync command 'itemoperations' from iPhone.
31 139 8 0 0 0 0 0 4 0 237 189 7 96 28 73 150 37 38 47 109 202 123 127 74 245 74 215 224 116 161 8 128 96 19 36 216 144 64 16 236 193 136 205 230 146 236 29 105 71 35 41 171 42 129 202 101 86 101 93 102 22 64 204 237 157 188 247 222 123 239 189 247 222 123 239 189 247 186 59 157 78 39 247 223 255 63 92 102 100 1 108 246 206 74 218 201 158 33 128 170 200 31 63 126 124 31 63 34 126 237 95 243 167 127 141 95 227 183 58 253 226 215 222 253 53 126 205 23 207 248 199 175 241 155 255 196 175 125 255 119 191 151 61 220 167 127 240 247 111 245 123 253 26 191 249 119 127 237 54 127 215 222 93 149 89 177 196 71 207 127 237 215 95 61 124 253 229 79 31 191 251 226 233 233 15 126 234 167 143 175 190 248 233 183 87 95 60 61 198 255 119 190 124 243 19 59 47 62 255 226 7 191 207 155 159 250 233 23 139 223 231 222 139 167 211 221 23 63 248 226 250 167 126 250 247 217 161 191 247 126 234 233 239 115 255 197 226 171 189 159 250 233 239 44 94 252 244 23 244 115 122 253 226 167 207 246 190 120 67 127 63 125 187 67 237 174 95 44 78 247 94 188 249 125 126 240 226 7 63 177 75 144 232 253 179 123 47 126 154 127 18 220 47 222 125 177 248 234 7 218 159 254 255 212 251 221 252 127 26 126 255 6 248 30 95 253 212 27 243 25 193 249 193 219 31 124 241 211 223 41 191 248 193 233 15 8 151 125 134 251 70 254 254 242 233 23 215 95 60 125 50 255 125 246 126 159 61 250 219 194 122 241 148 218 253 128 218 253 244 23 192 237 7 47 8 159 23 63 125 122 77 227 218 37 24 10 231 39 8 206 23 87 244 61 189 251 157 183 47 126 250 43 140 135 218 31 83 59 124 126 76 99 195 223 103 123 47 208 15 141 235 139 31 224 221 51 130 71 125 124 206 116 217 121 241 131 175 238 125 241 131 87 229 139 207 127 31 162 171 224 255 133 197 95 255 14 199 255 238 133 163 129 155 31 249 158 254 254 170 67 163 83 31 30 254 255 217 175 241 107 226 249 127 0 225 220 243 27 28 2 0 0
I don't know why it is not normal and expect it sholud start like this:
3 1 106 0 0 20 69 77 3 49 0 1 78 70 77 3 49 0 1 0 17 81 3 82 103 65 65 65 65 65 117 50 72 120 85 112 65 ..........
I think the response must have been encrypted, but what's the encryption algorithm?
Will be very appreciated for any ideas.
I have got the answer, the stream 31 139 8 0 0 0 0 0 4 0 237 189 7 96 28 73 150 37 ...... has been compressed by Gzip

Resources