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 8824823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:43:48+00:00 2026-06-14T06:43:48+00:00

I have almost zero experience with random generators. I have used the standard rand

  • 0

I have almost zero experience with random generators. I have used the standard rand functions in C and I have used perlin noise.

But now, I need a cube of resolution NxNxN (with N maybe 1e6 or bigger) filled with white noise (no perlin smoothness or whatever) in which I can just “pick” one value and if I repick that same value, it should be the same result every time. It should be seeded, so that if I start the application again, the results need to be the same. It should not be secure or whatever, just random enough so that a human being should not be able to predict values by just thinking. If he really analyses it with a computer, it’s ok that it’s predictable.

It’s like I would use the standard C rand function, setting the seed and doing a nested for loop for the 3 dimensions and generating a random number every time until I reach the coordinate. That is of course terribly slow. I need something that’s fast!

I have searched the internet and found a lot and nothing at the same time. Maybe I’m looking for the wrong keywords, but I haven’t found anything I can use.

Can anyone help me get started? Code? A link? I don’t really care if I understand the algorithms, but it should be easy to implement and use and should especially be fast.

  • 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-14T06:43:50+00:00Added an answer on June 14, 2026 at 6:43 am

    Since nobody seems to be able to answer the question, I have been researching on this and I have solved it with the following sollution:

    int pseudoRandom(int &seed)
    {
        const int a = 16807; // 7^5
        const int m = 2147483647; // 2^31 - 1
        seed = int(unsigned(seed * a) % m);
        return seed;
    }
    

    I take the above, well known, random function. It’s a good function as it can be easily be converted to a shader language, and can easily be expanded to 64-bit ints or something else.

    Now, I need to be able to create randoms between 0.0 and ?.? on 3 dimensions and they should always have the same result with the same base-seed, so I took the integer part of every component x, y and z, and a base-seed.

    int seed = baseseed;
    pseudoRandom(seed);
    pseudoRandom(seed * (int(x) + seed) * (int(y) + seed) * (int(z) + seed);
    

    => seed is now on the value where I can start making a detailed random grid.
    So if I need a detail of 32x32x32 random values, I just generate it here into an array.
    If I would have needed a bigger array, I could have done the same step again to generate another layer, like doing:

    pseudoRandom(seed * (int(x * 100) + seed) * (int(y * 100) + seed) * (int(z * 100) + seed);
    

    This way, you’re actually quite free on how you randomize, and you have full control of the detail.

    This solved my problem.

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

Sidebar

Related Questions

I admit that I have almost none experience of unittesting. I did a try
I almost have this Powershell script completed but I am stuck at the last
I have a server hosting a website of mine that has almost zero-traffic. A
I'm working on an online orderform using javascript. I almost have it working, but
I'm almost done with all my homework, but the last part I have to
I have almost the exact same question as at the following post (and I
I have almost 20 textboxes and to check all i have to call validate
I have almost 800 MB and over 31,000 files in hundreds of subfolders at
I have almost created a website that works in all major browsers flawlessly. Yesterday,
Note: I have almost no idea at all how batch file 'for' loops work.

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.