clc clear n=63;%the number of servers request_n=3000; %the number of request %An example of an IPv6 address is '2001:0DB8: 0000:0000:0008:0800:200C:417A'. D = hex2dec('FFFFFFFFFFFF'); %the first 12 digit in client IP address client_IP_rand = randi([0 D],1,request_n, 'single'); %%Example of a hash function based on mid-square sqr_client_IP_rand=client_IP_rand.^2; %square the client IP address st2= compose("%9.0f",sqr_client_IP_rand); % convert number to string for i=1:request_n-1 L=strlength(st2(i)); mid1=round(L./2); mid2=mid1+1; st=st2{1,i}(mid1:mid2); %used as key, the mid digit of the square client IP address hash_mid_square(i)=str2num(st); end hash_mid_square=mod(hash_mid_square,n); subplot (121);
clc clear n=63;%the number of servers request_n=3000; %the number of request %An example of an IPv6 address is '2001:0DB8: 0000:0000:0008:0800:200C:417A'. D = hex2dec('FFFFFFFFFFFF'); %the first 12 digit in client IP address client_IP_rand = randi([0 D],1,request_n, 'single'); %%Example of a hash function based on mid-square sqr_client_IP_rand=client_IP_rand.^2; %square the client IP address st2= compose("%9.0f",sqr_client_IP_rand); % convert number to string for i=1:request_n-1 L=strlength(st2(i)); mid1=round(L./2); mid2=mid1+1; st=st2{1,i}(mid1:mid2); %used as key, the mid digit of the square client IP address hash_mid_square(i)=str2num(st); end hash_mid_square=mod(hash_mid_square,n); subplot (121);
A First Course in Probability (10th Edition)
10th Edition
ISBN:9780134753119
Author:Sheldon Ross
Publisher:Sheldon Ross
Chapter1: Combinatorial Analysis
Section: Chapter Questions
Problem 1.1P: a. How many different 7-place license plates are possible if the first 2 places are for letters and...
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
Recommended textbooks for you
A First Course in Probability (10th Edition)
Probability
ISBN:
9780134753119
Author:
Sheldon Ross
Publisher:
PEARSON
A First Course in Probability (10th Edition)
Probability
ISBN:
9780134753119
Author:
Sheldon Ross
Publisher:
PEARSON