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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:32:48+00:00 2026-06-10T10:32:48+00:00

public float randomNumber(float x, float y, Random rnd) { //Return a random number between

  • 0
public float randomNumber(float x, float y, Random rnd)
{
    //Return a random number between 0 - 1
}

So my problem is I need the random number to be related to x and y. If I pass in x = 10, y = 5 and I get out 0.34567f when I pass in x = 10, y = 5 a second time I need a result of 0.34567f again. Does anyone know a way of doing this?

EDIT: Based on the responses below I realize I left something out. The reason I pass in the Random object is because it has been pre-seeded elsewhere. So if I pass in x = 10, y = 5 for a random object with a seed of 50 and get out 0.34567f doing the same thing with a Random object with a seed of 51 should give me something different.

  • 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-10T10:32:50+00:00Added an answer on June 10, 2026 at 10:32 am

    You can use them as a seed:

    int seed = 
        BitConverter.ToInt32(BitConverter.GetBytes(
            x * 17 + y
        ));
    new Random(seed).NextDouble();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I place objects on random positions on the screen (canvas) : public float X=Rnd.nextInt((MainGamePanel.width
public class Foo { public static void main(String[] args) { float f; System.out.println(f); }
Suppose I have a class: public class Vector { public float X { get;
sealed class PI { public static float number; static PI() { number = 3.141592653F;
For instance, along the lines of: public bool Intersect (Ray ray, out float distance,
I'm getting this error message with the code below: class Money { public: Money(float
public object MethodName(ref float y) { // elided } How do I define a
class Test { public: SOMETHING DoIt(int a) { float FLOAT = 1.2; int INT
I have the code: class Point3D{ protected: float x; float y; float z; public:
public static void main(String[] args) { int i = 0; while(i==0){ System.out.println(Possibilities: R, T,

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.