openSUSE Forums > Programming/Scripting » GSL Random Number Generators: Where?

Go Back   openSUSE Forums > Programming/Scripting
Forums FAQ Members List Search Today's Posts Mark Forums Read


Programming/Scripting Questions about programming, bash scripts, perl, php, cron jobs, ruby, python, etc.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-Sep-2009, 04:13
Puzzled Penguin
 
Join Date: Sep 2008
Location: Porto Alegre, RS, Brazil
Posts: 36
johannesrs hasn't been rated much yet
Question GSL Random Number Generators: Where?

Hi all.

I'm having a "simple" problem here: I'm not able to find the random number generator commands (random, rand, and alikes) in my Suse 11.0 here. Other commands, like factor, seq, are easilly found, but this one isn't. When I try to find it, it points me tu a executable in the /usr/games directory, which clearly isn't the one I'm looking for.

Could someone help me here with this? I'm thinking about creating a base for a genetic algorithm script here, and of course that can't be done without randoms...

Thanks in advance for any help!
Reply With Quote
  #2 (permalink)  
Old 12-Sep-2009, 05:15
Explorer Penguin
 
Join Date: Jul 2008
Location: Voorhout, Netherlands
Posts: 231
LittleRedRooster is on a distinguished reputation roadLittleRedRooster is on a distinguished reputation road
Default Re: GSL Random Number Generators: Where?

johannesrs wrote:
> Hi all.
>
> I'm having a "simple" problem here: I'm not able to find the random
> number generator commands (random, rand, and alikes) in my Suse 11.0
> here. Other commands, like factor, seq, are easilly found, but this one
> isn't. When I try to find it, it points me tu a executable in the
> /usr/games directory, which clearly isn't the one I'm looking for.
>
> Could someone help me here with this? I'm thinking about creating a
> base for a genetic algorithm script here, and of course that can't be
> done without randoms...
>
> Thanks in advance for any help!


There is no such command as 'random'
There are ways to get PRN (Pseudo Random Numbers) in e.g. Bash, Python and other
scripting languages.
E.g.
<Bash>
$echo $RANDOM
23595

$python
Python 2.6 (r26:66714, Feb 3 2009, 20:52:03)
[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from random import randint
>>> randint(0,65535)

9185

Using /dev/(u)random
$dd if=/dev/random bs=10 count=1 |xxd -a
1+0 records in
1+0 records out
0000000: f96d 9f71 563c 90ec 05c3 .m.qV<....


Theo
Reply With Quote
  #3 (permalink)  
Old 12-Sep-2009, 06:07
Puzzled Penguin
 
Join Date: Sep 2008
Location: Porto Alegre, RS, Brazil
Posts: 36
johannesrs hasn't been rated much yet
Default Re: GSL Random Number Generators: Where?

Ok, that's the trick, it's a variable for bash!

I usually use tcsh. Just in case, is there any equivalent for tcsh? I'm not finding it with google, only whole scripts...

Thanks a lot!
Reply With Quote
  #4 (permalink)  
Old 12-Sep-2009, 07:40
Explorer Penguin
 
Join Date: Jul 2008
Location: Voorhout, Netherlands
Posts: 231
LittleRedRooster is on a distinguished reputation roadLittleRedRooster is on a distinguished reputation road
Default Re: GSL Random Number Generators: Where?

johannesrs wrote:
> Ok, that's the trick, it's a variable for bash!
>
> I usually use tcsh. Just in case, is there any equivalent for tcsh? I'm
> not finding it with google, only whole scripts...
>
> Thanks a lot!


Not as far as I can see.

Theo
Reply With Quote
  #5 (permalink)  
Old 12-Sep-2009, 22:50
Puzzled Penguin
 
Join Date: Sep 2008
Location: Porto Alegre, RS, Brazil
Posts: 36
johannesrs hasn't been rated much yet
Default Re: GSL Random Number Generators: Where?

No problems so. Or I switch shells, or make a small "random" function to be called.

Thanks a lot anyway! That really saved me!
Reply With Quote
Reply

Bookmarks


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2