How to force a RANDOM enconunter?

Well i want to interact with an event who forces a random encounter. Not an encounter, a random one.
I was trying to search the script who make random encounte appears, but i failed. Please, someone help.
If the player is already interacting with an event, then you don't need a script to do this. You can just use event commands like so:
1644084265396.png
This also works.
Ruby:
# use script call in event
# $game_player.encounter_count = 0
# to call a random encounter on the map

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Set Encounter Count
  #--------------------------------------------------------------------------
  def encounter_count=(value)
    @encounter_count = value
  end
end
If the player is already interacting with an event, then you don't need a script to do this. You can just use event commands like so:
View attachment 215321
Thanks, this works very well!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-force-a-random-enconunter.144424/