Skip to content
Snippets Groups Projects
user avatar
Mark authored
The code currently calls RandomInt twice to generate an address.
For example, if you want to generate the address 192.168.A.B,
RandomInt will be called twice to generate the values for A and B.
To save resources, we can avoid calling RandomInt twice by reusing
the same random value with different masks for A and B.
Before:
  -  RandomInt() & 0xff00 -> A
  -  RandomInt() & 0x00ff -> B
After:
  -  RandomInt() & 0xffff -> A.B

Bug: 312647670
Test: atest TetheringTests
Change-Id: Iee49af3d82781309f78fe66ab07937b8137fa259
f25af65b
History