本文介绍了检查是否已随机选择字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.

我写了一种生成随机MAC地址(6个字节)的方法.

首先,我创建一个唯一的GUID.

接下来,我将GUID转换为字节数组.

最后,我从GUID字节数组中的特定位置选择6个字节,并将其格式化为十六进制MAC地址字符串.

我想做的是(在我的字节数组函数中)检查是否已生成任何生成的MAC地址,并处理这种情况.

最好怎么做?

谢谢

我尝试过的事情:

尝试了一些似乎不起作用的比较函数

Hi.

I have wrote a method that generates random MAC addresses (6 bytes).

First, I create a unique GUID.

Next, I convert the GUID to a byte array.

Finally, I select 6 bytes from specific locations in the GUID byte array and format this as a HEX MAC address string.

What I would like to do is check (in my byte array function) if any of the generated MAC addresses have already been generated, and handle that situation.

How is best to do this?

Thank you

What I have tried:

Tried a number of compare functions that do notseem to work

推荐答案


这篇关于检查是否已随机选择字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 01:18