3 Replies - 6327 Views - Last Post: 04 July 2012 - 11:29 AM

#1 Tom_Leonardsson  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 67
  • Joined: 07-August 11

How to make a perl script that prints random 0s and 1s?

Posted 03 July 2012 - 07:53 AM

hi!
I want to make a script that prints random 0s and 1s in a txt file.
How whould the code look? I know how to prtint stuff into a txt file but how do I do so it's random?

Thanks for any help!
Is This A Good Question/Topic? 0
  • +

Replies To: How to make a perl script that prints random 0s and 1s?

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8365
  • View blog
  • Posts: 31,080
  • Joined: 12-June 08

Re: How to make a perl script that prints random 0s and 1s?

Posted 03 July 2012 - 07:56 AM

Typically using the 'rand' function.

http://perlmeme.org/...d_function.html
Was This Post Helpful? 2
  • +
  • -

#3 dsherohman  Icon User is offline

  • Perl Parson
  • member icon

Reputation: 226
  • View blog
  • Posts: 654
  • Joined: 29-March 09

Re: How to make a perl script that prints random 0s and 1s?

Posted 04 July 2012 - 12:15 AM

If you're still having problems after reading up on rand(), post the code that you've tried and we can help you get it working, including explanations of why it didn't work.
Was This Post Helpful? 0
  • +
  • -

#4 Tom_Leonardsson  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 67
  • Joined: 07-August 11

Re: How to make a perl script that prints random 0s and 1s?

Posted 04 July 2012 - 11:29 AM

View Postdsherohman, on 04 July 2012 - 12:15 AM, said:

If you're still having problems after reading up on rand(), post the code that you've tried and we can help you get it working, including explanations of why it didn't work.


I got it working.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1