Skip to content
Commit f25af65b authored by Mark's avatar Mark Committed by Mark Chien
Browse files

Avoid random twice to generate an address

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
parent 11162e97
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment