• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

array of random numbers

 
son dunckley
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have managed to get an array to generate random numbers between 0 and 99. However, I would also like the array to contain negative numbers as well but cannot work out how to do this?

Anyone able to offer advise on this please?

My code is:

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
get the number and perform minus operation with 0 for example:

0-10 => -10

hope that is what you are looking.
 
Jeffrey Spaulding
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Max Random = 200

your number = -100 + generatedRandomNumber

J.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic