java - Convert string to rubbish -


i trying create function takes in input string , returns rubbish string value

string foobar (string input) {   string rubbish;   ......   ......   returns rubbish  } 

the rubbish string value similar below

enter image description here

i appreciate if able provide me sample function or guide me on how go doing it

if want function return same garbage same input string, work fine.

public string rubbish(string input) {     string result = "";      long seed = 0;     long size = 0;      for(int = 0; < input.length(); ++)     {         seed += input.charat(i);     }      seed %= long.max_value;     size = seed % 3000;      random rand = new random(seed);      for(int = 0; < size; ++)     {         result += (char)rand.nextint(256);     }      return result; } 

additionally, if want string different each time, can change new random(seed) new random() , it'll randomize string.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -