Jump to content
Sign in to follow this  
z0mgItsJohn

Help Me With Random =]

Recommended Posts

Hello AutoIt Team.. Can Some One Tell Me How To Make A Script To Write 26 Different File Lines But Each File Line Has A Random Number Between 1 And 100 In It Because When I Do "Random (1,100)" It Gives Me Stuff Like 51.32454564561 And I Want It To Be 1 - 100 Could Someones Maybe Write An Example Script =] ~Thanks

Edited by John2006

Share this post


Link to post
Share on other sites

Heres The Script...

For $A = 1 to 26
$R = Random (1,100)
FileWriteLine ( "Example.txt", "Random Number " & $A & " = " & $R )
Next
Exit

That Gives Me Stuff Like This

Random Number 1 = 66.9071129134391

Random Number 2 = 17.5579881030135

Random Number 3 = 8.52681446820498

Random Number 4 = 62.6429312610999

Random Number 5 = 3.04733501304872

Random Number 6 = 63.5854946416803

Random Number 7 = 35.7243336706888

Random Number 8 = 1.32979785744101

Random Number 9 = 93.5578034920618

Random Number 10 = 31.1244053104892

Random Number 11 = 46.0171440995764

Random Number 12 = 80.9961013242137

Random Number 13 = 48.21694414597

Random Number 14 = 8.98742191796191

Random Number 15 = 58.8788336494472

Random Number 16 = 10.0229984314647

Random Number 17 = 51.6035362090915

Random Number 18 = 29.1051140415948

Random Number 19 = 51.6525496267714

Random Number 20 = 16.0197925532702

Random Number 21 = 64.6922066889238

Random Number 22 = 43.4511030386202

Random Number 23 = 21.5115717514418

Random Number 24 = 9.86890342389233

Random Number 25 = 75.2631118257996

Random Number 26 = 48.7247451283038

Share this post


Link to post
Share on other sites

Help Pretty Please ='[

Just look in the help. Set the flag to get integers. Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Yay.. Figured It Out =]

For $A = 1 to 26
$R = Random (1,100,1)
FileWriteLine ( "Example.txt", "Random Number " & $A & " = " & $R )
Next
Exit

This Gives Me

Random Number 1 = 48

Random Number 2 = 73

Random Number 3 = 4

Random Number 4 = 24

Random Number 5 = 34

Random Number 6 = 45

Random Number 7 = 67

Random Number 8 = 39

Random Number 9 = 59

Random Number 10 = 49

Random Number 11 = 5

Random Number 12 = 9

Random Number 13 = 3

Random Number 14 = 35

Random Number 15 = 27

Random Number 16 = 17

Random Number 17 = 62

Random Number 18 = 96

Random Number 19 = 96

Random Number 20 = 12

Random Number 21 = 23

Random Number 22 = 12

Random Number 23 = 67

Random Number 24 = 82

Random Number 25 = 98

Random Number 26 = 76

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...