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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:12:54+00:00 2026-05-13T13:12:54+00:00

Using Windows Detours in C++, I’ve seen that it is possible to trampoline function

  • 0

Using Windows Detours in C++, I’ve seen that it is possible to trampoline function calls so that you may intercept windows base functionality and return custom resultsets, without modifying the original function call.

I was wondering if there is any way to override a Java Randomization call so that I may implement my own result set. In a previous question, I asked if there was any way to make C# mimic the Java randomization function. As a possible solution, without cluttering up the other question, I wanted to know if anyone has had any experience in implementing a “detoured-like” solution.

  • 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-13T13:12:55+00:00Added an answer on May 13, 2026 at 1:12 pm

    If you are responsible for instantiating a java.util.Random object, then you can subclass java.util.Random and instantiate your own class instead. If some other code, that you cannot change, is responsible for the instantiation, then you obviously cannot use your own subclass. I expect this is not an option in your case.

    Another alternative is to change the implementation at class load time. Basically you rewrite the bytecode of java.util.Random to do something else than what it does by default. The downside of this is that it will affect all instances of java.util.Random, not just the one instance that you might want to change. Then again, most code do not rely on the implementation details of the RNG so this probably isn’t an issue.

    Javassist is quite a nice byte code library. It’ll allow you to rewrite byte code at class load time, so you could, e.g. replace the body of the method that produces the random number with a call to your own class that implements the RNG algorithm that you need.

    You could write a simple class file processor that will be run for the java.util.Random class. The code might be something like this:

    ClassPool pool = ClassPool.getDefault();
    CtClass cc = pool.get("Random"); // maybe java.util.Random
    CtMethod m = cc.getDeclaredMethod("nextLong");
    m.setBody("my.super.duper.RandomClass.nextLong()");
    cc.writeFile();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using windows server, I have a path to a file that, when you click
Using Windows XP, I created a batch-file that takes two files as arguments, and
I'm using Windows 7 and x64 cpu. Does it mean that I should always
Using Windows 2003, I'm look for a way to create a logoff script that
Without using windows service? Is it possible?
Using Windows So I'm reading from a binary file a list of unsigned int
Using Windows Mobile 6.5 and C# The CharacterCasing property seems to be missing from
Using Windows form (Vb.net & Datagridview) Checkbox is using in datagridview row. I want
Iam using windows forms. How can I query all child controls of a Form
Am using windows xp sp3 on netbook and i need to compile c# programs

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.