{"action":"created","comment":{"url":"https://api.github.com/repos/tomassedovic/tcod-rs/pulls/comments/38666006","id":38666006,"diff_hunk":"@@ -0,0 +1,452 @@\n+//! Noise toolkit.\n+//!\n+//! Rust bindings follow the original API pretty closely.\n+\n+use bindings::ffi;\n+use bindings::AsNative;\n+\n+use random::Rng;\n+\n+/// Available noise types.\n+#[repr(C)]\n+#[derive(Copy, Clone, PartialEq, Eq, Debug)]\n+pub enum NoiseType {\n+    Default = ffi::TCOD_NOISE_DEFAULT as isize,\n+    Perlin  = ffi::TCOD_NOISE_PERLIN as isize,\n+    Simplex = ffi::TCOD_NOISE_SIMPLEX as isize,\n+    Wavelet = ffi::TCOD_NOISE_WAVELET as isize,\n+}\n+\n+/// Noise object encapsulates a noise generator.\n+#[derive(Debug)]\n+pub struct Noise {\n+    noise: ffi::TCOD_noise_t,\n+    dimensions: u32\n+}\n+\n+/// Default hurst value.\n+pub const DEFAULT_HURST: f32 = 0.5;\n+\n+/// Default lacunarity value.\n+pub const DEFAULT_LACUNARITY: f32 = 2.0;\n+\n+/// Maximum number of octaves for turbulence and fbm noise functions.\n+pub const MAX_OCTAVES: u32 = 128;\n+\n+impl Noise {\n+    /// Return an instance of [NoiseInitializer](./struct.NoiseInitializer.html)\n+    /// which is used to customize the creation of Noise object.\n+    pub fn init_with_dimensions(dimensions: u32) -> NoiseInitializer {\n+        NoiseInitializer::new_init_with_dimensions(dimensions)\n+    }\n+\n+    pub fn set_type(&self, noise_type: NoiseType) {\n+        unsafe {\n+            ffi::TCOD_noise_set_type(self.noise, noise_type as u32)\n+        }\n+    }\n+\n+    pub fn get(&self, coords: &mut [f32]) -> f32 {","path":"src/noise.rs","position":49,"original_position":49,"commit_id":"a9e2ce0f7c66c76a7e97012cc476f1f410ce998f","original_commit_id":"a9e2ce0f7c66c76a7e97012cc476f1f410ce998f","user":{"login":"Gustorn","id":2189776,"avatar_url":"https://avatars.githubusercontent.com/u/2189776?v=3","gravatar_id":"","url":"https://api.github.com/users/Gustorn","html_url":"https://github.com/Gustorn","followers_url":"https://api.github.com/users/Gustorn/followers","following_url":"https://api.github.com/users/Gustorn/following{/other_user}","gists_url":"https://api.github.com/users/Gustorn/gists{/gist_id}","starred_url":"https://api.github.com/users/Gustorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gustorn/subscriptions","organizations_url":"https://api.github.com/users/Gustorn/orgs","repos_url":"https://api.github.com/users/Gustorn/repos","events_url":"https://api.github.com/users/Gustorn/events{/privacy}","received_events_url":"https://api.github.com/users/Gustorn/received_events","type":"User","site_admin":false},"body":"Yes, that should work fine. ","created_at":"2015-09-03T16:30:11Z","updated_at":"2015-09-03T16:30:11Z","html_url":"https://github.com/tomassedovic/tcod-rs/pull/196#discussion_r38666006","pull_request_url":"https://api.github.com/repos/tomassedovic/tcod-rs/pulls/196","_links":{"self":{"href":"https://api.github.com/repos/tomassedovic/tcod-rs/pulls/comments/38666006"},"html":{"href":"https://github.com/tomassedovic/tcod-rs/pull/196#discussion_r38666006"},"pull_request":{"href":"https://api.github.com/repos/tomassedovic/tcod-rs/pulls/196"}}},"pull_request":{"url":"https://api.github.com/repos/tomassedovic/tcod-rs/pulls/196","id":44010035,"html_url":"https://github.com/tomassedovic/tcod-rs/pull/196","diff_url":"https://github.com/tomassedovic/tcod-rs/pull/196.diff","patch_url":"https://github.com/tomassedovic/tcod-rs/pull/196.patch","issue_url":"https://api.github.com/repos/tomassedovic/tcod-rs/issues/196","number":196,"state":"open","locked":false,"title":"Wrapper around Noise","user":{"login":"tomob","id":1015581,"avatar_url":"https://avatars.githubusercontent.com/u/1015581?v=3","gravatar_id":"","url":"https://api.github.com/users/tomob","html_url":"https://github.com/tomob","followers_url":"https://api.github.com/users/tomob/followers","following_url":"https://api.github.com/users/tomob/following{/other_user}","gists_url":"https://api.github.com/users/tomob/gists{/gist_id}","starred_url":"https://api.github.com/users/tomob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomob/subscriptions","organizations_url":"https://api.github.com/users/tomob/orgs","repos_url":"https://api.github.com/users/tomob/repos","events_url":"https://api.github.com/users/tomob/events{/privacy}","received_events_url":"https://api.github.com/users/tomob/received_events","type":"User","site_admin":false},"body":"Along with demo in samples.","created_at":"2015-09-02T16:01:43Z","updated_at":"2015-09-03T16:30:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e82c934a6301d9d4be67e843204abfdd25e9a4cb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tomassedovic/tcod-rs/pulls/196/commits","review_comments_url":"https://api.github.com/repos/tomassedovic/tcod-rs/pulls/196/comments","review_comment_url":"https://api.github.com/repos/tomassedovic/tcod-rs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tomassedovic/tcod-rs/issues/196/comments","statuses_url":"https://api.github.com/repos/tomassedovic/tcod-rs/statuses/a9e2ce0f7c66c76a7e97012cc476f1f410ce998f","head":{"label":"tomob:noise","ref":"noise","sha":"a9e2ce0f7c66c76a7e97012cc476f1f410ce998f","user":{"login":"tomob","id":1015581,"avatar_url":"https://avatars.githubusercontent.com/u/1015581?v=3","gravatar_id":"","url":"https://api.github.com/users/tomob","html_url":"https://github.com/tomob","followers_url":"https://api.github.com/users/tomob/followers","following_url":"https://api.github.com/users/tomob/following{/other_user}","gists_url":"https://api.github.com/users/tomob/gists{/gist_id}","starred_url":"https://api.github.com/users/tomob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomob/subscriptions","organizations_url":"https://api.github.com/users/tomob/orgs","repos_url":"https://api.github.com/users/tomob/repos","events_url":"https://api.github.com/users/tomob/events{/privacy}","received_events_url":"https://api.github.com/users/tomob/received_events","type":"User","site_admin":false},"repo":{"id":40916418,"name":"tcod-rs","full_name":"tomob/tcod-rs","owner":{"login":"tomob","id":1015581,"avatar_url":"https://avatars.githubusercontent.com/u/1015581?v=3","gravatar_id":"","url":"https://api.github.com/users/tomob","html_url":"https://github.com/tomob","followers_url":"https://api.github.com/users/tomob/followers","following_url":"https://api.github.com/users/tomob/following{/other_user}","gists_url":"https://api.github.com/users/tomob/gists{/gist_id}","starred_url":"https://api.github.com/users/tomob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomob/subscriptions","organizations_url":"https://api.github.com/users/tomob/orgs","repos_url":"https://api.github.com/users/tomob/repos","events_url":"https://api.github.com/users/tomob/events{/privacy}","received_events_url":"https://api.github.com/users/tomob/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tomob/tcod-rs","description":"Rust bindings for libtcod 1.5.1 (the Doryen library/roguelike toolkit)","fork":true,"url":"https://api.github.com/repos/tomob/tcod-rs","forks_url":"https://api.github.com/repos/tomob/tcod-rs/forks","keys_url":"https://api.github.com/repos/tomob/tcod-rs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomob/tcod-rs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomob/tcod-rs/teams","hooks_url":"https://api.github.com/repos/tomob/tcod-rs/hooks","issue_events_url":"https://api.github.com/repos/tomob/tcod-rs/issues/events{/number}","events_url":"https://api.github.com/repos/tomob/tcod-rs/events","assignees_url":"https://api.github.com/repos/tomob/tcod-rs/assignees{/user}","branches_url":"https://api.github.com/repos/tomob/tcod-rs/branches{/branch}","tags_url":"https://api.github.com/repos/tomob/tcod-rs/tags","blobs_url":"https://api.github.com/repos/tomob/tcod-rs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomob/tcod-rs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomob/tcod-rs/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomob/tcod-rs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomob/tcod-rs/statuses/{sha}","languages_url":"https://api.github.com/repos/tomob/tcod-rs/languages","stargazers_url":"https://api.github.com/repos/tomob/tcod-rs/stargazers","contributors_url":"https://api.github.com/repos/tomob/tcod-rs/contributors","subscribers_url":"https://api.github.com/repos/tomob/tcod-rs/subscribers","subscription_url":"https://api.github.com/repos/tomob/tcod-rs/subscription","commits_url":"https://api.github.com/repos/tomob/tcod-rs/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomob/tcod-rs/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomob/tcod-rs/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomob/tcod-rs/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomob/tcod-rs/contents/{+path}","compare_url":"https://api.github.com/repos/tomob/tcod-rs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomob/tcod-rs/merges","archive_url":"https://api.github.com/repos/tomob/tcod-rs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomob/tcod-rs/downloads","issues_url":"https://api.github.com/repos/tomob/tcod-rs/issues{/number}","pulls_url":"https://api.github.com/repos/tomob/tcod-rs/pulls{/number}","milestones_url":"https://api.github.com/repos/tomob/tcod-rs/milestones{/number}","notifications_url":"https://api.github.com/repos/tomob/tcod-rs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomob/tcod-rs/labels{/name}","releases_url":"https://api.github.com/repos/tomob/tcod-rs/releases{/id}","created_at":"2015-08-17T17:58:35Z","updated_at":"2015-08-17T17:58:37Z","pushed_at":"2015-09-03T08:57:37Z","git_url":"git://github.com/tomob/tcod-rs.git","ssh_url":"git@github.com:tomob/tcod-rs.git","clone_url":"https://github.com/tomob/tcod-rs.git","svn_url":"https://github.com/tomob/tcod-rs","homepage":"","size":6453,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tomassedovic:master","ref":"master","sha":"20bdc592971a5e7ab65238fca57e73cba6a11e8d","user":{"login":"tomassedovic","id":104339,"avatar_url":"https://avatars.githubusercontent.com/u/104339?v=3","gravatar_id":"","url":"https://api.github.com/users/tomassedovic","html_url":"https://github.com/tomassedovic","followers_url":"https://api.github.com/users/tomassedovic/followers","following_url":"https://api.github.com/users/tomassedovic/following{/other_user}","gists_url":"https://api.github.com/users/tomassedovic/gists{/gist_id}","starred_url":"https://api.github.com/users/tomassedovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomassedovic/subscriptions","organizations_url":"https://api.github.com/users/tomassedovic/orgs","repos_url":"https://api.github.com/users/tomassedovic/repos","events_url":"https://api.github.com/users/tomassedovic/events{/privacy}","received_events_url":"https://api.github.com/users/tomassedovic/received_events","type":"User","site_admin":false},"repo":{"id":20941939,"name":"tcod-rs","full_name":"tomassedovic/tcod-rs","owner":{"login":"tomassedovic","id":104339,"avatar_url":"https://avatars.githubusercontent.com/u/104339?v=3","gravatar_id":"","url":"https://api.github.com/users/tomassedovic","html_url":"https://github.com/tomassedovic","followers_url":"https://api.github.com/users/tomassedovic/followers","following_url":"https://api.github.com/users/tomassedovic/following{/other_user}","gists_url":"https://api.github.com/users/tomassedovic/gists{/gist_id}","starred_url":"https://api.github.com/users/tomassedovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomassedovic/subscriptions","organizations_url":"https://api.github.com/users/tomassedovic/orgs","repos_url":"https://api.github.com/users/tomassedovic/repos","events_url":"https://api.github.com/users/tomassedovic/events{/privacy}","received_events_url":"https://api.github.com/users/tomassedovic/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tomassedovic/tcod-rs","description":"Rust bindings for libtcod 1.5.1 (the Doryen library/roguelike toolkit)","fork":false,"url":"https://api.github.com/repos/tomassedovic/tcod-rs","forks_url":"https://api.github.com/repos/tomassedovic/tcod-rs/forks","keys_url":"https://api.github.com/repos/tomassedovic/tcod-rs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomassedovic/tcod-rs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomassedovic/tcod-rs/teams","hooks_url":"https://api.github.com/repos/tomassedovic/tcod-rs/hooks","issue_events_url":"https://api.github.com/repos/tomassedovic/tcod-rs/issues/events{/number}","events_url":"https://api.github.com/repos/tomassedovic/tcod-rs/events","assignees_url":"https://api.github.com/repos/tomassedovic/tcod-rs/assignees{/user}","branches_url":"https://api.github.com/repos/tomassedovic/tcod-rs/branches{/branch}","tags_url":"https://api.github.com/repos/tomassedovic/tcod-rs/tags","blobs_url":"https://api.github.com/repos/tomassedovic/tcod-rs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomassedovic/tcod-rs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomassedovic/tcod-rs/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomassedovic/tcod-rs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomassedovic/tcod-rs/statuses/{sha}","languages_url":"https://api.github.com/repos/tomassedovic/tcod-rs/languages","stargazers_url":"https://api.github.com/repos/tomassedovic/tcod-rs/stargazers","contributors_url":"https://api.github.com/repos/tomassedovic/tcod-rs/contributors","subscribers_url":"https://api.github.com/repos/tomassedovic/tcod-rs/subscribers","subscription_url":"https://api.github.com/repos/tomassedovic/tcod-rs/subscription","commits_url":"https://api.github.com/repos/tomassedovic/tcod-rs/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomassedovic/tcod-rs/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomassedovic/tcod-rs/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomassedovic/tcod-rs/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomassedovic/tcod-rs/contents/{+path}","compare_url":"https://api.github.com/repos/tomassedovic/tcod-rs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomassedovic/tcod-rs/merges","archive_url":"https://api.github.com/repos/tomassedovic/tcod-rs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomassedovic/tcod-rs/downloads","issues_url":"https://api.github.com/repos/tomassedovic/tcod-rs/issues{/number}","pulls_url":"https://api.github.com/repos/tomassedovic/tcod-rs/pulls{/number}","milestones_url":"https://api.github.com/repos/tomassedovic/tcod-rs/milestones{/number}","notifications_url":"https://api.github.com/repos/tomassedovic/tcod-rs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomassedovic/tcod-rs/labels{/name}","releases_url":"https://api.github.com/repos/tomassedovic/tcod-rs/releases{/id}","created_at":"2014-06-17T22:43:56Z","updated_at":"2015-08-30T22:50:36Z","pushed_at":"2015-09-03T08:57:38Z","git_url":"git://github.com/tomassedovic/tcod-rs.git","ssh_url":"git@github.com:tomassedovic/tcod-rs.git","clone_url":"https://github.com/tomassedovic/tcod-rs.git","svn_url":"https://github.com/tomassedovic/tcod-rs","homepage":"","size":8974,"stargazers_count":41,"watchers_count":41,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":19,"mirror_url":null,"open_issues_count":7,"forks":19,"open_issues":7,"watchers":41,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tomassedovic/tcod-rs/pulls/196"},"html":{"href":"https://github.com/tomassedovic/tcod-rs/pull/196"},"issue":{"href":"https://api.github.com/repos/tomassedovic/tcod-rs/issues/196"},"comments":{"href":"https://api.github.com/repos/tomassedovic/tcod-rs/issues/196/comments"},"review_comments":{"href":"https://api.github.com/repos/tomassedovic/tcod-rs/pulls/196/comments"},"review_comment":{"href":"https://api.github.com/repos/tomassedovic/tcod-rs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tomassedovic/tcod-rs/pulls/196/commits"},"statuses":{"href":"https://api.github.com/repos/tomassedovic/tcod-rs/statuses/a9e2ce0f7c66c76a7e97012cc476f1f410ce998f"}}}}