Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7922305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:54:18+00:00 2026-06-03T16:54:18+00:00

I try to port classic Perlin Noise (src: http://mrl.nyu.edu/~perlin/doc/oscar.html#noise ) to JavaScript – for

  • 0

I try to port classic Perlin Noise (src: http://mrl.nyu.edu/~perlin/doc/oscar.html#noise) to JavaScript – for scientific purposes. I don’t know why, but my code generates a periodic pattern instead of a random pattern.

You can find my full code with an example drawn to canvas here (stripped down to one dimension): http://jsfiddle.net/YL77D/

I think the problem can be found within the “noise1” function:

sx = s_curve(rx0);

u = rx0 * g1[ p[ bx0 ] ];
v = rx1 * g1[ p[ bx1 ] ];

return lerp(sx, u, v);

If my x-seed is 10.1, 10.2, 10.3, etc. I think u and v should be the same number (u should be based on 10 and v should be based on 11 – so sx is somewhere between). Am I right? But in my code u and v is allways different.

Any ideas? Thank you very much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:54:19+00:00Added an answer on June 3, 2026 at 4:54 pm

    One problem might be the way you use Math.Random:

    p[i] = p[j = Math.floor(Math.random() % B)];
    

    In javascript Math.Random returns a floating point value between 0 and 1.
    random in C returns an integer value between 0 and RAND_MAX.

    p[i] = p[j = random() % B];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small script that I am try to port to work for
It's now one week exactly that I try to port a simple activity-based app
If I run a server with the port 80, and I try to use
When creating a Socket in Java: new Socket(host, port); The Socket constructor will try
Take this code into consideration: Proxy p = new Proxy(Type.SOCKS, new InetSocketAddress(proxyURL, port)); try
Try executing the following in JavaScript: parseInt('01'); //equals 1 parseInt('02'); //equals 2 parseInt('03'); //equals
I'm currently taking a computer security class and would like to try to port
I try to port some C++ code from Windows to Linux, but I can't
When I try to port my Win32 code from Microsoft toolchain to MinGW, most
I'm trying to install opencv using MacPort. i try: sudo port selfupdate sudo port

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.