-
Notifications
You must be signed in to change notification settings - Fork 0
/
randomon.m
47 lines (34 loc) · 1010 Bytes
/
randomon.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
% randomiser for pokemon
function[]=randomon(myseed)
% reuse same seed to keep list same
%
% ma june 2020
close all
clc
if nargin<1
myseed = randi(1000000,1,1);
disp(myseed)
rng(myseed)
else
disp(myseed)
rng(myseed)
end
% 18 types
types = {'Normal','Fighting','Flying','Poison',...
'Ground','Rock','Bug','Ghost', 'Steel','Fire',...
'Water','Grass','Electric','Psychic','Ice',...
'Dragon','Dark','Fairy'};
msize = numel(types);
Jim = types(randperm(msize)); % this creates the permutation
Michael = types(randperm(msize));
% this implies there are no replacements e.g. no repeats of using the same
% team again
% table
varTypes = {'cell','cell'};
varNames = {'Jim','Michael'};
T = table('Size',[18 2],'VariableTypes',varTypes,'VariableNames',varNames); %preallocate
% now fill!
T.Jim = Jim(:);
T.Michael = Michael(:);
writecell(T.Jim,'/Users/ppzma/Google Drive/randOM/poketable_jim.txt')
writecell(T.Michael,'/Users/ppzma/Google Drive/randOM/poketable_michael.txt')