[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

How to change this php code to servlet?

Hi

How to change the folloiwing php code:

$random = rand();
$response = 'services/search/tmp/' . $random . '.gif';

to java servlet?


0
techques
Asked:
techques
1 Solution
 
mahomeCommented:
This should fit:
You can choose MAX_RANDOM to your wishes

int MAX_RANDOM = 99999;
Double random = Math.floor(Math.random() *  MAX_RANDOM);
String response = "services/search/tmp/" + random.intValue() + ".gif";

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now