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

  • Home
  • SEARCH
  • 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 6623427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:31:54+00:00 2026-05-25T21:31:54+00:00

Just to be fully up front, this is regarding a homework, but this in

  • 0

Just to be fully up front, this is regarding a homework, but this in itself is not the assignment. The assignment is using noise to create cool graphics. I have a bit of experience in Python but not enough to figure this simple thing out.

I’m having trouble generating a seeded-random [-1,1]. The pseudocode my teacher gave me is from Hugo Elias.

Pseudocode:

function Noise1(integer x, integer y)
    n = x + y * 57
    n = (n<<13) ^ n;
    return ( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0);    
  end function

My attempt in Python:

def noise(x, y):
    n = x + y * 57
    n = (n<<5) ^ n;
    return ( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0)

The problem is the & 7fffffff bit in return statement. First, I’m not sure what that operation is. Maybe a bit-shift? Second, I’m not sure how to do that operation in Python. I had just removed that part, but I am getting huge negative numbers, nowhere near a [-1,1]

  • 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-05-25T21:31:54+00:00Added an answer on May 25, 2026 at 9:31 pm

    The & symbol stands for bitwise AND
    The ^ symbol stands for bitwise XOR

    and the 7FFFFFFF is a HEX number.
    In programming you can represent a hex number using 0x where 7FFFFFFF is 0x7FFFFFFF
    Some further reading on hex numbers.

    To do a binary AND in python you just use & 0x7FFFFFFF
    see more here about bitwise operations in python

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's something wrong with my code or I'm just not understanding this fully. I
Not that it matters strictly, and maybe I just don't yet fully understand how
I'm obviously not talking about a full solution, but just a good starting point
I have tried to do this here http://wonderfl.net/c/9Kdv but what I want is not
When I click with a full finger (not just a gentle touch) on or
Is there a way to have a full interpreter in Erlang, not just a
Okay, I thought I would be able to do this no problem, but for
I am trying to do this, I'm a full time front-end dev and am
Ive just started C and I'm trying to do this queue implementation program from
This program is not giving Queue Overflow error message when its full. Why is

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.