In Mini Program, how does JS take the module after hashing a string?

I want to implement the need to enter a name to get a random answer, but enter the same name to get the same answer.
read the post and said I wanted to hash the number, and now I have transcoded the name entered by the user into five digits. Next, how to hash it and get a fixed random number in a specified range?

onLoad: function (options) {

this.data.name = wx.getStorageSync("name");
this.setData({
  name: this.data.name
});

this.setData({
  words: this.data.name.charCodeAt(0)
});
Jul.11,2021


Math.seed = this.data.words;
Math.seededRandom = function(max, min) {
  max = max || 0;
  min = min || 10;
  Math.seed = (Math.seed * 9301 + 49297) % 233280;
  var rnd = Math.seed / 233280.0;
  return min + rnd * (max - min);
};
for (var i = 0; i < 10; iPP) {
  console.log(Math.seededRandom());
}
Menu