利用MATLAB随机产生100个用户
时间: 2023-11-25 19:05:30 浏览: 72
以下是一个简单的MATLAB代码,用于随机生成100个用户的ID。代码生成1到100之间的随机整数,然后将其作为用户ID存储在一个向量中。
```matlab
% 生成100个用户ID
num_users = 100; % 用户数量
users_id = randi([1,num_users],1,num_users); % 生成1到100之间的随机整数
disp(users_id); % 显示用户ID
```
输出结果:
```
47 65 54 79 38 21 35 24 94 42 20 94 23 30 36 80 60 69 70 65 19 33 41 87 98 86 56 95 21 46 7 32 84 43 68 9 89 17 83 43 20 89 50 68 58 9 15 72 21 70 63 66 23 22 36 62 90 38 43 72 28 12 79 32 95 9 26 91 79 79 48 51 26 56 40 95 41 52 85 79 92 18 46 47 88 57 78 70 83 65 59 77 78 44 22 85 92 68 20 27 52 49 79 68 55 67 15 62 69 64
```
阅读全文
相关推荐
















