IPB

Welcome Guest ( Log In | Register )

2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 
Reply to this topicStart new topic
> --Idea for a Function--, --Hard TO Describe-See Inside--
ViRaL
post Jun 1 2009, 06:26 PM
Post #1


_.-*:.-ViRaL-.:*-._
***

Group: Members
Posts: 115
Joined: 17-March 09
From: Washington, Tacoma--- Op iVD--Us East
Member No.: 48,022



The %Rand function Selects a Random Number between (1,Inf.)

Is there any way you could have it randomly select a value instead Lets say,

I make a list (Called 1's Maps)

Command would look like this, !pick1s %ListRand(1's Maps), [Randomly selects a map value from the list]
So on and so forth !pick2s %ListRand(2's Maps), [Randomly Selects a map value from the list]

or something diffrent but similar , !Pick2s %Rand(Luna,Python,Lost Temple,Neo Lost Temple)

Like this.
laugh.gif cool.gif




--------------------
NOTICES: For those of you who post in the Script Creation Requests/"ViRaLs CCX Help Section" Forum.

If you dont use this format-- I will let you slide once--- The second time-- You get no help at all

EXPLANATION: A very detailed explanation of the desired script.
COMMANDs:
--------!Command1 - Detailed explanation of command, including required access, and desired output (whispered, emoted, etc.)
--------!Command2 - Detailed explanation of command, including required access, and desired output (whispered, emoted, etc.)

Please put required parameters in "< >", and optional in "[ ]" (Example: .score [username])

Do NOT bump... Requests Take time... Which I can't devote entirely to you. Please be PATIENT
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post Jun 1 2009, 06:40 PM
Post #2


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



CODE
Private Function RanNum(minimum, maximum)

   RanNum = Int(((maximum + 1) - (minimum)) * Rnd + (minimum))
End Function
Look in the Useful Things thread.


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Snap
post Jun 1 2009, 06:52 PM
Post #3


The following post is supplementry information
*****

Group: Global Moderators
Posts: 2,922
Joined: 29-January 06
From: Eugene Oregon
Member No.: 31



I think he's talking about CCX. ~ Moved.

Right now you have to do %item(%rand(1,3),Luna|Python|Lost Temple,|) (The default separator for %item is a space)
Or %switch(%rand(1,3),1,Luna,2,Python,3,Lost Temple).
Or if the list exists; %listitem(%rand(1,%listsize(MYLIST)),MYLIST)

This isn't that complicated- but i'll see about making this simpler - as it appears to be used a bit.


--------------------
~Life is all busy and stuff right now. - Car accident, lots of dr. appointments... Other stuff too. I still <3 StealthBot.net - - I'll be around.
Thinking about PMing me? Post it instead! CCX Forums | SnapNJacks Trivia Forums
IPB Image
IPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Jack
post Jun 1 2009, 07:06 PM
Post #4


Ultimate spammer.
********

Group: Sr. Members
Posts: 5,593
Joined: 28-January 06
Member No.: 28



Functions for sequences:

random.choice(seq)
Return a random element from the non-empty sequence seq. If seq is empty, raises IndexError.

------
random.sample(population, k)
Return a k length list of unique elements chosen from the population sequence. Used for random sampling without replacement.

New in version 2.3.

Returns a new list containing elements from the population while leaving the original population unchanged. The resulting list is in selection order so that all sub-slices will also be valid random samples. This allows raffle winners (the sample) to be partitioned into grand prize and second place winners (the subslices).

Members of the population need not be hashable or unique. If the population contains repeats, then each occurrence is a possible selection in the sample.

To choose a sample from a range of integers, use an xrange() object as an argument. This is especially fast and space efficient for sampling from a large population: sample(xrange(10000000), 60).

I <3 the python random class.


--------------------
IPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
SamuelDeuter
post Jun 1 2009, 07:17 PM
Post #5


Full Of Win Member
***

Group: Sr. Members
Posts: 237
Joined: 6-December 06
Member No.: 13,536



QUOTE(ViRaL @ Jun 1 2009, 05:26 PM) *

The %Rand function Selects a Random Number between (1,Inf.)

Having a random number between 1 and infinity isn't viable due to the fact that a range from 1 to infinity has an infinite amount of possibilities, which includes numbers like One Googalplex which is so long it would take years for your computer to process. Traditionally in programming a random variable is a random number from 0 to .9999+ which with a little math can be used in a lot of different applications.

Edit: Here's an example on my TI-84 Plus!

IPB Image

This post has been edited by SamuelDeuter: Jun 1 2009, 07:28 PM


--------------------
Movie Night, do it faggot...
---------------------

Sam, you are sick... ~Hdx
You too sexy ;) ~Sam




[url="lol no"]Clan BoT[/url]
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
riffruff
post Jun 1 2009, 07:26 PM
Post #6


I riffruff
********

Group: Sr. Members
Posts: 3,727
Joined: 19-February 06
From: USA
Member No.: 278



I think he used Inf as a placeholder to represent any number can be put in there.


--------------------
What you should tell your girlfriend...
QUOTE
ALL men see in only 16 colors, like Windows default settings. Peach, for example, is a fruit, not a color. Pumpkin is also a fruit. We have no idea what mauve is.

QUOTE
Women, learn to work the toilet seat. You're a big girl. If it's up, put it down. We need it up, you need it down. You don't hear us complaining about you leaving it down.

http://riffruff.mybrute.com
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
SamuelDeuter
post Jun 1 2009, 07:31 PM
Post #7


Full Of Win Member
***

Group: Sr. Members
Posts: 237
Joined: 6-December 06
Member No.: 13,536



QUOTE(riffruff @ Jun 1 2009, 06:26 PM) *

I think he used Inf as a placeholder to represent any number can be put in there.

Saying 1 to Infinity is a very bad way to express a range.


--------------------
Movie Night, do it faggot...
---------------------

Sam, you are sick... ~Hdx
You too sexy ;) ~Sam




[url="lol no"]Clan BoT[/url]
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
ViRaL
post Jun 1 2009, 07:56 PM
Post #8


_.-*:.-ViRaL-.:*-._
***

Group: Members
Posts: 115
Joined: 17-March 09
From: Washington, Tacoma--- Op iVD--Us East
Member No.: 48,022



@Snap, Yeh, I was talking about CCX, but the other answers WERE EXTREMELY HELPFUL to my knowledge of Python.

@Jack&Ninja Thanks ALOT!

I accidently posted it in the wrong spot, hit the back arrow on accident before i hit New Topic


--------------------
NOTICES: For those of you who post in the Script Creation Requests/"ViRaLs CCX Help Section" Forum.

If you dont use this format-- I will let you slide once--- The second time-- You get no help at all

EXPLANATION: A very detailed explanation of the desired script.
COMMANDs:
--------!Command1 - Detailed explanation of command, including required access, and desired output (whispered, emoted, etc.)
--------!Command2 - Detailed explanation of command, including required access, and desired output (whispered, emoted, etc.)

Please put required parameters in "< >", and optional in "[ ]" (Example: .score [username])

Do NOT bump... Requests Take time... Which I can't devote entirely to you. Please be PATIENT
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 13th November 2019 - 12:49 AM
Skin by Andrea
Website Legal Information | Hosted by LunarPages