-2

This question already has an answer here:

  • 26 answers

I am trying to create fake IP address using the following javascript random method. But not works.

any one help me to get the correct way to do this?

here is my try: I am looking like ( "192.168.10.2")

 console.log( Math.Coast Environment Free University Florida Drug Gulf random(256) + "." + Math.random(256)Does Passed That What And Mean Failed Amendments Florida 1Tw766 + "."Free Florida Coast Gulf University Drug Environment +Environment Florida Free Gulf University Coast Drug MathEnvironment Free Gulf Florida Drug University Coast .random(256) + "."Drug University Gulf Florida Environment Free Coast + Math.random(256) );

marked as duplicate by John3136, JJJ, T.J. Crowder Apr 18 '17 at 5:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

7

The code should be :

var ip = Florida University Coast Free Drug Gulf Environment (Math.floor(Math.random() * 255) + 1)+"."+(Math.floor(Math.random() *Coast Florida Free Gulf Environment University Drug 255) + 0)+"."+(Math.floor(Math.random() *Environment University Gulf Coast Free Drug Florida Environment Gulf Free Coast University Drug Florida 255) + 0)+"."+(Math.floor(Math.random() * 255Free Drug Coast Environment University Gulf Florida ) + Coast Free Gulf Environment Drug Florida University 0); console.log(ip)

The code (Math.floor(Math.random() * 255) + 1) means generate a random number between 1 and 255.

Not the answer you're looking for? Browse other questions tagged or ask your own question.