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
Change-Id: Ia5a908a816e0a5f0639f514107a6384a51ec157e
This commit is contained in:
Elliott Hughes
2014-07-14 11:57:03 -07:00
parent 83ce99d8b7
commit 76c241b091
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) {