Upgrade rust/crates/rand_xorshift to 0.3.0

Test: make
Change-Id: I1d2d73bec75171071ecc96fd7eb6fd499bbccf83
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 2619177..306696e 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
 {
   "git": {
-    "sha1": "5610bdae3acdb0324f5636bb3e4a21e6324ead72"
+    "sha1": "eae0a9b91c5de272706134d25bc1ea3457bc9670"
   }
 }
diff --git a/Android.bp b/Android.bp
index 4c05bab..6ad2307 100644
--- a/Android.bp
+++ b/Android.bp
@@ -63,5 +63,5 @@
 // dependent_library ["feature_list"]
 //   bincode-1.3.1
 //   byteorder-1.3.4 "default,std"
-//   rand_core-0.5.1
+//   rand_core-0.6.0
 //   serde-1.0.118 "default,std"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ce3098a..52367bd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,11 @@
 The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [0.3.0] - 2020-12-18
+- Bump `rand_core` version to 0.6 (#17)
+- Derive PartialEq+Eq for XorShiftRng (#6)
+- Bump serde to 1.0.118 so that `serde1` feature can also be no-std (#12)
+
 ## [0.2.0] - 2019-06-12
 - Bump minor crate version since rand_core bump is a breaking change
 - Switch to Edition 2018
diff --git a/Cargo.toml b/Cargo.toml
index 0260d13..335c5d1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,30 +13,26 @@
 [package]
 edition = "2018"
 name = "rand_xorshift"
-version = "0.2.0"
+version = "0.3.0"
 authors = ["The Rand Project Developers", "The Rust Project Developers"]
 description = "Xorshift random number generator\n"
-homepage = "https://crates.io/crates/rand_xorshift"
-documentation = "https://rust-random.github.io/rand/rand_xorshift/"
+homepage = "https://rust-random.github.io/book"
+documentation = "https://docs.rs/rand_xorshift"
 readme = "README.md"
 keywords = ["random", "rng", "xorshift"]
 categories = ["algorithms", "no-std"]
-license = "MIT/Apache-2.0"
-repository = "https://github.com/rust-random/rand"
+license = "MIT OR Apache-2.0"
+repository = "https://github.com/rust-random/rngs"
 [dependencies.rand_core]
-version = "0.5"
+version = "0.6"
 
 [dependencies.serde]
-version = "1"
+version = "1.0.118"
 features = ["derive"]
 optional = true
+default-features = false
 [dev-dependencies.bincode]
 version = "1"
 
 [features]
 serde1 = ["serde"]
-[badges.appveyor]
-repository = "rust-random/rand"
-
-[badges.travis-ci]
-repository = "rust-random/rand"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index c47bcc9..78d3f5f 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,12 +1,12 @@
 [package]
 name = "rand_xorshift"
-version = "0.2.0"
+version = "0.3.0" # NB: When modifying, also modify html_root_url in lib.rs
 authors = ["The Rand Project Developers", "The Rust Project Developers"]
-license = "MIT/Apache-2.0"
+license = "MIT OR Apache-2.0"
 readme = "README.md"
-repository = "https://github.com/rust-random/rand"
-documentation = "https://rust-random.github.io/rand/rand_xorshift/"
-homepage = "https://crates.io/crates/rand_xorshift"
+repository = "https://github.com/rust-random/rngs"
+documentation = "https://docs.rs/rand_xorshift"
+homepage = "https://rust-random.github.io/book"
 description = """
 Xorshift random number generator
 """
@@ -14,16 +14,12 @@
 categories = ["algorithms", "no-std"]
 edition = "2018"
 
-[badges]
-travis-ci = { repository = "rust-random/rand" }
-appveyor = { repository = "rust-random/rand" }
-
 [features]
 serde1 = ["serde"]
 
 [dependencies]
-rand_core = { path = "../rand_core", version = "0.5" }
-serde = { version = "1", features = ["derive"], optional = true }
+rand_core = { version = "0.6" }
+serde = { version = "1.0.118", default-features = false, features = ["derive"], optional = true }
 
 [dev-dependencies]
 # This is for testing serde, unfortunately we can't specify feature-gated dev
diff --git a/METADATA b/METADATA
index e5dac18..f53f05c 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/rand_xorshift/rand_xorshift-0.2.0.crate"
+    value: "https://static.crates.io/crates/rand_xorshift/rand_xorshift-0.3.0.crate"
   }
-  version: "0.2.0"
+  version: "0.3.0"
   license_type: NOTICE
   last_upgrade_date {
     year: 2020
     month: 12
-    day: 15
+    day: 18
   }
 }
diff --git a/README.md b/README.md
index 57de284..df7fa33 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,12 @@
 # rand_xorshift
 
-[![Build Status](https://travis-ci.org/rust-random/rand.svg)](https://travis-ci.org/rust-random/rand)
-[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rand?svg=true)](https://ci.appveyor.com/project/rust-random/rand)
+[![Build Status](https://travis-ci.org/rust-random/rngs.svg)](https://travis-ci.org/rust-random/rngs)
+[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rngs?svg=true)](https://ci.appveyor.com/project/rust-random/rngs)
 [![Latest version](https://img.shields.io/crates/v/rand_xorshift.svg)](https://crates.io/crates/rand_xorshift)
 [![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/)
 [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_xorshift)
 [![API](https://docs.rs/rand_xorshift/badge.svg)](https://docs.rs/rand_xorshift)
-[![Minimum rustc version](https://img.shields.io/badge/rustc-1.32+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements)
+[![Minimum rustc version](https://img.shields.io/badge/rustc-1.32+-lightgray.svg)](https://github.com/rust-random/rngs#rust-version-requirements)
 
 Implements the Xorshift random number generator.
 
@@ -22,7 +22,7 @@
 
 -   [API documentation (master)](https://rust-random.github.io/rand/rand_xorshift)
 -   [API documentation (docs.rs)](https://docs.rs/rand_xorshift)
--   [Changelog](https://github.com/rust-random/rand/blob/master/rand_xorshift/CHANGELOG.md)
+-   [Changelog](https://github.com/rust-random/rngs/blob/master/rand_xorshift/CHANGELOG.md)
 
 [rand]: https://crates.io/crates/rand
 
diff --git a/src/lib.rs b/src/lib.rs
index 769921f..7fb59a4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -10,7 +10,7 @@
 
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
        html_favicon_url = "https://www.rust-lang.org/favicon.ico",
-       html_root_url = "https://rust-random.github.io/rand/")]
+       html_root_url = "https://docs.rs/rand_xorshift/0.3.0")]
 
 #![deny(missing_docs)]
 #![deny(missing_debug_implementations)]
@@ -18,7 +18,7 @@
 #![no_std]
 
 use core::num::Wrapping as w;
-use core::{fmt, slice};
+use core::fmt;
 use rand_core::{RngCore, SeedableRng, Error, impls, le};
 #[cfg(feature="serde1")] use serde::{Serialize, Deserialize};
 
@@ -31,7 +31,7 @@
 /// [^1]: Marsaglia, George (July 2003).
 ///       ["Xorshift RNGs"](https://www.jstatsoft.org/v08/i14/paper).
 ///       *Journal of Statistical Software*. Vol. 8 (Issue 14).
-#[derive(Clone)]
+#[derive(Clone, PartialEq, Eq)]
 #[cfg_attr(feature="serde1", derive(Serialize,Deserialize))]
 pub struct XorShiftRng {
     x: w<u32>,
@@ -71,7 +71,8 @@
     }
 
     fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
-        Ok(self.fill_bytes(dest))
+        self.fill_bytes(dest);
+        Ok(())
     }
 }
 
@@ -98,26 +99,19 @@
     }
 
     fn from_rng<R: RngCore>(mut rng: R) -> Result<Self, Error> {
-        let mut seed_u32 = [0u32; 4];
+        let mut b = [0u8; 16];
         loop {
-            unsafe {
-                let ptr = seed_u32.as_mut_ptr() as *mut u8;
-
-                let slice = slice::from_raw_parts_mut(ptr, 4 * 4);
-                rng.try_fill_bytes(slice)?;
+            rng.try_fill_bytes(&mut b[..])?;
+            if !b.iter().all(|&x| x == 0) {
+                break;
             }
-            for v in seed_u32.iter_mut() {
-                // enforce LE for consistency across platforms
-                *v = v.to_le();
-            }
-            if !seed_u32.iter().all(|&x| x == 0) { break; }
         }
 
         Ok(XorShiftRng {
-            x: w(seed_u32[0]),
-            y: w(seed_u32[1]),
-            z: w(seed_u32[2]),
-            w: w(seed_u32[3]),
+            x: w(u32::from_le_bytes([b[0], b[1], b[2], b[3]])),
+            y: w(u32::from_le_bytes([b[4], b[5], b[6], b[7]])),
+            z: w(u32::from_le_bytes([b[8], b[9], b[10], b[11]])),
+            w: w(u32::from_le_bytes([b[12], b[13], b[14], b[15]])),
         })
     }
 }