Sponsored Content
The Lounge What is on Your Mind? How To Analyze This (Cryptography Random?) Permutation...? Post 302319814 by lucky7 on Tuesday 26th of May 2009 08:57:29 AM
Old 05-26-2009
Hi Neo,
Yes, I've read the rules. This isn't a homework, just brainteaser we're trying to work out. We're so poor in computer & programming, that's why we put this on programming forum, and our company isn't in computer business.
Someone has made a program in python like below, but it was for numbers 1 to 80 inside each table. We don't know how to modify the program if inside each table only numbers 1 to 20 like file New.xls above.

Code:
 
import random
group = [[]*10 for i in range(0,8)]
#-----------------------------------------
group[0] = [1,5,9,13,17,21,25,29,33,37]
group[1] = [41,45,49,53,57,61,65,69,73,77]
#-----------------------------------------
group[2] = [2,6,10,14,18,22,26,30,34,38]
group[3] = [42,46,50,54,58,62,66,70,74,78]
group[4] = [3,7,11,15,19,23,27,31,35,39]
group[5] = [43,47,51,55,59,63,67,71,75,79]
group[6] = [4,8,12,16,20,24,28,32,36,40]
group[7] = [44,48,52,56,60,64,68,72,76,80]
#-----------------------------------------
row = [0]*10
temp =[0]*10
 
for i in range(0,10):
   row[i] = []
   temp[i] = []
 
for i in range(0,8):
   place = 0
   for j in range(0,10):
      place = random.randint(place,j)
      temp[place] = temp[place][:]+[group[i][j]]
   white = 0
   place = 9
   print temp
   for j in range(0,10):
      if len(temp[place]) == 0:
         white = white +1
      else:
         newrow =random.randint(place,place+white)
         temp[newrow] = temp[place]
         if newrow != place:
            temp[place] = []
         white = newrow -place
      place = place -1
   print temp
   for j in range(0,10):
      if len(temp[j]) != 0:
         row[j] = row[j][:] +temp[j][:]
         temp[j] = []
for i in range(0,10):
       print row[i]

Thx.
 

9 More Discussions You Might Find Interesting

1. Cybersecurity

Firewalls and cryptography

As we know, firewall is designed to keep unauthorized outsiders from tampering with a computer system or network. We don't talk about computer security without cryptography. In this case, may I know,How does cryptographic protection (at the TCP/IP layers or at the application layer) affect a... (1 Reply)
Discussion started by: heroine
1 Replies

2. Shell Programming and Scripting

Cryptography

Hi, I have a file which contains 4 columns. I want to encrypt only the first column. The rest of data must be as it is. flat file: 12234333 jakdjf 394839 343874 73746373 5jdkfdj 383993 958939 83473843 lksdjfj 388383 349399 so, 1 should be replace by 4, 2 with 8, 3 with 7..... the... (4 Replies)
Discussion started by: javeed7
4 Replies

3. Ubuntu

expect script for random password and random commands

Hi I am new to expect. Please if any one can help on my issue its really appreciable. here is my issue: I want expect script for random passwords and random commands generation. please can anyone help me? Many Thanks in advance (0 Replies)
Discussion started by: vanid
0 Replies

4. Red Hat

Need help in allowing symmetric cryptography[2]

I have encountered some problems in my school work. Here is the question: The server that provides the time synchronization must be configured to allow its clients to verify its authenticity using symmetric cryptography. Much Appreciated!:) (1 Reply)
Discussion started by: wilsonljx
1 Replies

5. Homework & Coursework Questions

Need help in allowing symmetric cryptography[2]

The server that provides the time synchronization must be configured to allow its clients to verify its authenticity using symmetric cryptography. 4. Singapore Polytechnic, Dover, Singapore,Mr Kam, and Computer Engineering I don't think there is any coding since it is just configuring... (3 Replies)
Discussion started by: wilsonljx
3 Replies

6. Shell Programming and Scripting

Arbitrary permutation and combination script

#!/bin/bash # permutation_combination.sh # Version: 2.0 # Author : YongYe <complex.invoke@gmail.com> arg0=-1 argv=${3} number=${2} eval ary=({1..${1}}) length=${#ary} percom(){ nsloop i ${1} number${2} ${3} ${4} ${5}; } invoke(){ echo $(percom ${argu} nsloop -1) prtcom $(percom... (1 Reply)
Discussion started by: complex.invoke
1 Replies

7. Shell Programming and Scripting

[Solved] Permutation

Hi, I am trying to permutate each column (Except for IDS). file.txt FID IID TOAST1 TOAST2 TOAST3 ID3 ID3 1 -9 2 ID4 ID4 2 1 1 ID1 ID1 -9 -9 1 ID8 ID8 1 1 -9 ID12 ID12 1 2 2 for toast1 column, there are two 1's, two 2's and one -9. Having the same number of denominations,... (2 Replies)
Discussion started by: johnkim0806
2 Replies

8. Shell Programming and Scripting

Need to generate a file with random data. /dev/[u]random doesn't exist.

Need to use dd to generate a large file from a sample file of random data. This is because I don't have /dev/urandom. I create a named pipe then: dd if=mynamed.fifo do=myfile.fifo bs=1024 count=1024 but when I cat a file to the fifo that's 1024 random bytes: cat randomfile.txt >... (7 Replies)
Discussion started by: Devyn
7 Replies

9. Shell Programming and Scripting

Permutation Words in awk

i have 13 different words. I need to get permutations like all combinations of this words: word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12 word13 But the combinations only should be 12 words long. Is there a fast efficient way to do this? Maybe with linux tool... (1 Reply)
Discussion started by: watcherpro
1 Replies
Test::Excel::Template::Plus(3pm)			User Contributed Perl Documentation			  Test::Excel::Template::Plus(3pm)

NAME
Test::Excel::Template::Plus - Testing module for use with Excel::Template::Plus SYNOPSIS
use Test::More tests => 1; use Test::Excel::Template::Plus; my $template = Excel::Template::Plus->new( engine => 'TT', template => 'test.tmpl', config => { INCLUDE => [ '/templates' ] }, params => { ... } ); $template->write_file('test.xls'); # compare the file we just made with # an existing example file ... cmp_excel_files("test.xls", "t/xls/test.xls", '... the excel files matched'); DISCLAIMER
This module is woefully incomplete. It works for my very basic purposes right now, but it is surely going to need lots or work in the future to make it really usable. DESCRIPTION
This module attempts to provide a means of testing and comparing dynamically generated excel files. Currently it only supports comparing two excel files for some approximation of strutural (values within cells) and visual (formatting of said cells) equivalence. As a by product of the implementation, elements may get compared which don't really need comparing, and things which do need comparing may be skipped. This will get refined as time goes by and the module is used in more heavyweight situations. FUNCTIONS
cmp_excel_files($file1, $file2, $msg) BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT. AUTHOR
Stevan Little <stevan@iinteractive.com> COPYRIGHT AND LICENSE
Copyright 2007-2010 by Infinity Interactive, Inc. <http://www.iinteractive.com> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-05-06 Test::Excel::Template::Plus(3pm)
All times are GMT -4. The time now is 03:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy