Replacing code with random number
#1

I have a few thousands of lines with this code :
Код:
0.00,-1, -1, -1,200);
Can I somehow automaticly (maybe with notepad++) replace 0.00 with random number for all the lines? It would take ages to do it myself
Reply
#2

CTRL + H
Paste in 0.00,-1, -1, -1,200); at top,
at bottom,
random(1)/*0 or 1*/,-1, -1, -1,200);
Reply
#3

Quote:

The range of values (from 0 to this value minus one) that can be returned.

random(1) will always return 0, random(2) will return 0 or 1. Also OP wants compile time random values, not runtime ones. Sorry, I only know how to write a plugin for sublime, I don't know if notepad++ supports such thing
Reply
#4

You're probably going to need a little script to do it. I don't see any feasible way to do it by hand, not even with regex. I would probably replace all those 0.00 values with %.2f and copy those lines to a file in the scriptfiles folder. Then create a little script that reads from that file, one line at a time. Use the line as the string input for format() and then put a random number in. Write the output to another file. Then you can finally copy that output back into the script.
Reply
#5

Just use the replace feature? As they are the same.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)