//
// Created by lk on 18-10-14.
//
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <fstream>
#define random(a,b) (rand()%(b-a)+a)
using namespace std;
int main()
{
fstream fs("C:\\Users\\lenovo\\Desktop\\bluetooth.txt", ios::out);
srand((int)time(0)); // 产生随机种子 把0换成NULL也行
int last = 0;
int current;
int* address = new int();
for (int k=0;k<50;++k)
{
for (int j = 0; j < random(20, 30); ++j)
{
current = random(80, 100);
if (current != last)
{
address = new int();
}
fs << address << " ";
last = current;
}
fs << endl;
}
fs.close();
system("pause");
return 0;
}//5 5 9 7 9 6 5 5 7 7 产生5到10之间的数, 不包括5 和 10
采用c++内存地址模拟50个用户手机搜集到的蓝牙mac地址,取堆上的地址,真的极为巧妙!