Function Repository Resource:

RandomMetalPseudoSubgenre

Source Notebook

Generate a new metal subgenre in the spirit of the many metal microgenres

Contributed by: Christopher Stover

ResourceFunction["RandomMetalPseudoSubgenre"][]

generates a String consisting of one random (probably-fictitious) metal subgenre.

ResourceFunction["RandomMetalPseudoSubgenre"][n]

generates a List of n subgenres.

ResourceFunction["RandomMetalPseudoSubgenre"][UpTo[n]]

is the same as ResourceFunction["RandomMetalPseudoSubgenre"][n].

ResourceFunction["RandomMetalPseudoSubgenre"][{n1,n2,}]

generates an n1×n2× array of subgenres.

Details

In the above, the arguments n and ni must be integers.
ResourceFunction["RandomMetalPseudoSubgenre"] automatically threads over lists of integers.
ResourceFunction["RandomMetalPseudoSubgenre"] uses RandomInteger and RandomSample under the hood to create as much randomness as possible, but duplicates may still exist (see "Possible Issues" below).

Examples

Basic Examples (1) 

Generate a random (probably-fictitious) metal subgenre:

In[1]:=
ResourceFunction["RandomMetalPseudoSubgenre"][]
Out[1]=

Scope (3) 

Here are five random (probably-fictitious) metal subgenres:

In[2]:=
list1 = ResourceFunction["RandomMetalPseudoSubgenre"][5]
Out[2]=

It may be easier to read as a Column:

In[3]:=
Column[list1]
Out[3]=

Using UpTo provides a different way to get five random (probably-fictitious) metal subgenres:

In[4]:=
ResourceFunction["RandomMetalPseudoSubgenre"][UpTo[5]]
Out[4]=

Here is an array of random (probably-fictitious) metal subgenres:

In[5]:=
list2 = ResourceFunction["RandomMetalPseudoSubgenre"][{1, 2, 3}]
Out[5]=

The nesting is easier to visualize using Grid with the FrameAll option:

In[6]:=
Grid[list2, Frame -> All]
Out[6]=

Possible Issues (2) 

RandomMetalPseudoSubgenre[n] returns unevaluated when n is any data type not mentioned in "Usage":

In[7]:=
ResourceFunction["RandomMetalPseudoSubgenre"][a]
Out[7]=
In[8]:=
ResourceFunction["RandomMetalPseudoSubgenre"][3.2]
Out[8]=
In[9]:=
ResourceFunction["RandomMetalPseudoSubgenre"][Sqrt[7]]
Out[9]=
In[10]:=
ResourceFunction["RandomMetalPseudoSubgenre"]["wolfram"]
Out[10]=

RandomMetalPseudoSubgenre uses RandomInteger and RandomSample under the hood to create as much randomness as possible. For small samples, this is generally enough to avoid duplicates:

In[11]:=
t1 = ResourceFunction["RandomMetalPseudoSubgenre"][50];
In[12]:=
t1 == DeleteDuplicates[t1]
Out[12]=

Even so, duplicates may still exist in larger examples:

In[13]:=
t2 = ResourceFunction["RandomMetalPseudoSubgenre"][5000];
In[14]:=
t2 == DeleteDuplicates[t2]
Out[14]=
In[15]:=
cc = Counts[t2];
cc[[Select[Range[Length[cc]], Values[cc][[#]] > 1 &]]]
Out[16]=

Neat Examples (6) 

While all of the examples are neat, some stand out more than others. For example, sometimes, you get really long subgenre names:

In[17]:=
long = ResourceFunction["RandomMetalPseudoSubgenre"][]
Out[17]=
In[18]:=
StringLength[long]
Out[18]=

And sometimes, the subgenre names are really short:

In[19]:=
short = ResourceFunction["RandomMetalPseudoSubgenre"][]
Out[19]=
In[20]:=
StringLength[short]
Out[20]=

On average, however, the lengths of the subgenre names tend to be more average. Experimental evidence suggests that the Mean and Median of the subgenre name lengths are both around 50:

In[21]:=
N@Mean[StringLength[
   ResourceFunction["RandomMetalPseudoSubgenre"][1000]]]
Out[21]=
In[22]:=
Median[StringLength[
  ResourceFunction["RandomMetalPseudoSubgenre"][1000]]]
Out[22]=

To make metal seem more academic, you can test the Mean/Median hypothesis by using StringLength on longer and longer lists of subgenres. This yields a pair of datasets (where x is the length of the subgenre list and y is the Mean/Median of the corresponding list's string lengths) which seem to support the hypothesis.

Here is a plot of the corresponding Mean data:

In[23]:=
means = Table[{n, N@Mean[StringLength[
       ResourceFunction["RandomMetalPseudoSubgenre"][n]]]}, {n, 1, max1 = 100}];
ListPlot[means, Epilog -> {Red, Line[{{0, 50}, {max1, 50}}]}, PlotRange -> {Automatic, {25, 75}}]
Out[1]=

And here is one for the Median data:

In[24]:=
meds = Table[{n, N@Median[
      StringLength[
       ResourceFunction["RandomMetalPseudoSubgenre"][n]]]}, {n, 1, max2 = 100}];
ListPlot[meds, Epilog -> {Red, Line[{{0, 50}, {max2, 50}}]}, PlotRange -> {Automatic, {25, 75}}]
Out[3]=

The trend can be summarized by taking the Mean of the means and the Median of the medians. Again, the results are very close to 50:

In[25]:=
Mean[means[[All, 2]]] // N
Out[25]=
In[26]:=
Median[meds[[All, 2]]] // N
Out[26]=

Publisher

therealcstover

Version History

  • 1.0.0 – 14 March 2022

Related Resources

Author Notes

There are several other notable metal genre prefixes that could have gone into the lists used herein; however, some prefixes deemed either "trivial" or "obscene" were omitted.
There is a great deal of musical knowledge built in to the Wolfram Language. As a starting point, one can check the entities listed under the "Music" subsection at Guide: Cultural Data.

License Information