{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/13663","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/13663/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/13663/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/13663/events","html_url":"https://github.com/rust-lang/rust/issues/13663","id":31912145,"number":13663,"title":"Seed RNGs with a uniform type","user":{"login":"SiegeLord","id":480550,"avatar_url":"https://avatars.githubusercontent.com/u/480550?v=3","gravatar_id":"","url":"https://api.github.com/users/SiegeLord","html_url":"https://github.com/SiegeLord","followers_url":"https://api.github.com/users/SiegeLord/followers","following_url":"https://api.github.com/users/SiegeLord/following{/other_user}","gists_url":"https://api.github.com/users/SiegeLord/gists{/gist_id}","starred_url":"https://api.github.com/users/SiegeLord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SiegeLord/subscriptions","organizations_url":"https://api.github.com/users/SiegeLord/orgs","repos_url":"https://api.github.com/users/SiegeLord/repos","events_url":"https://api.github.com/users/SiegeLord/events{/privacy}","received_events_url":"https://api.github.com/users/SiegeLord/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-libs","name":"A-libs","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2014-04-21T18:09:11Z","updated_at":"2015-04-14T05:58:31Z","closed_at":null,"body":"I think it would be convenient to have a uniform way to reseed all RNGs. Currently, each RNG could potentially use (and often does so in practice) a different seed type for the `SeedableRng` trait implementation. I propose that trait to have the following two methods (and an associated function) added:\r\n\r\n~~~rust\r\n/// Number of bits needed to completely reseed the generator\r\nfn get_seed_size(&self) -> uint;\r\n\r\n/// Reseeds the RNG using an array of u64's, padded with 0's if needed.\r\n/// If more data is given than could be used, it is first reduced using a hash.\r\nfn reseed(&mut self, &[u64]);\r\nfn from_seed(&[u64]) -> Self;\r\n~~~\r\n\r\nThe current methods could either be removed, or renamed to `reseed_exact` etc. It currently appears that some RNGs already do something similar to what the proposed functions do, while others (e.g. `XorShiftRng`) require the complete state."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/92620050","html_url":"https://github.com/rust-lang/rust/issues/13663#issuecomment-92620050","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/13663","id":92620050,"user":{"login":"cybergeek94","id":3198595,"avatar_url":"https://avatars.githubusercontent.com/u/3198595?v=3","gravatar_id":"","url":"https://api.github.com/users/cybergeek94","html_url":"https://github.com/cybergeek94","followers_url":"https://api.github.com/users/cybergeek94/followers","following_url":"https://api.github.com/users/cybergeek94/following{/other_user}","gists_url":"https://api.github.com/users/cybergeek94/gists{/gist_id}","starred_url":"https://api.github.com/users/cybergeek94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cybergeek94/subscriptions","organizations_url":"https://api.github.com/users/cybergeek94/orgs","repos_url":"https://api.github.com/users/cybergeek94/repos","events_url":"https://api.github.com/users/cybergeek94/events{/privacy}","received_events_url":"https://api.github.com/users/cybergeek94/received_events","type":"User","site_admin":false},"created_at":"2015-04-14T05:58:31Z","updated_at":"2015-04-14T05:58:31Z","body":"@huonw @steveklabnik Should this be closed now that `rand` is out-of-tree?"}}