forked from tykayn/funky-framadate-front
fix types
This commit is contained in:
parent
54ece76c7e
commit
7b5cf59b99
@ -25,7 +25,7 @@ export class CipheringComponent implements OnInit {
|
|||||||
public prem: number;
|
public prem: number;
|
||||||
public dico: string[];
|
public dico: string[];
|
||||||
public separatedCouples: any[];
|
public separatedCouples: any[];
|
||||||
public codingMatrice: string = '2 3 5 8';
|
public codingMatrice = '2 3 5 8';
|
||||||
private cipheredTextCIL: string;
|
private cipheredTextCIL: string;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -193,8 +193,12 @@ export class CipheringComponent implements OnInit {
|
|||||||
* on entre une définition de matrice en écrivant 4 nombres dans un input
|
* on entre une définition de matrice en écrivant 4 nombres dans un input
|
||||||
* @param stringMatrix
|
* @param stringMatrix
|
||||||
*/
|
*/
|
||||||
convertStringToMatrix(stringMatrix: string) {
|
convertStringToMatrix(stringMatrix: string): number[] {
|
||||||
return stringMatrix.replace(',', ' ').replace(' ', ' ').slice(' ');
|
return stringMatrix
|
||||||
|
.replace(',', ' ')
|
||||||
|
.replace(' ', ' ')
|
||||||
|
.split(' ')
|
||||||
|
.map((elem) => parseInt(elem));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -281,8 +285,8 @@ export class CipheringComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getEntropy(s) {
|
getEntropy(s) {
|
||||||
let sum = 0,
|
let sum = 0;
|
||||||
len = s.length;
|
const len = s.length;
|
||||||
this.process(s, (k, f) => {
|
this.process(s, (k, f) => {
|
||||||
const p = f / len;
|
const p = f / len;
|
||||||
sum -= (p * Math.log(p)) / Math.log(2);
|
sum -= (p * Math.log(p)) / Math.log(2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user