Implement rand/srand in terms of random/srandom.

Code developed for glibc or older versions of bionic might expect more
randomness than the BSD implementation provides.

Bug: 15829381

(cherry picked from commit 76c241b091)

Change-Id: If721b3f16efdb21cb67df5ec5034c0ba905bd029
This commit is contained in:
Elliott Hughes
2014-07-14 11:57:03 -07:00
parent caaf71ebb3
commit 99ae0983c0
4 changed files with 30 additions and 65 deletions

View File

@@ -53,17 +53,10 @@ TEST(stdlib, random) {
TEST(stdlib, rand) {
srand(0x01020304);
#if defined(__BIONIC__)
EXPECT_EQ(1675538669, rand());
EXPECT_EQ(1678228258, rand());
EXPECT_EQ(1352350131, rand());
EXPECT_EQ(824068976, rand());
#else
EXPECT_EQ(55436735, rand());
EXPECT_EQ(1399865117, rand());
EXPECT_EQ(2032643283, rand());
EXPECT_EQ(571329216, rand());
#endif
}
TEST(stdlib, mrand48) {