A random access method, wherein the method comprises: receiving a configuration information element from a network device, wherein the configuration information element indicates a correspondence between a downlink signal and a random access occasion, and the correspondence between the downlink signal and the random access occasion comprises a quantity of downlink signals per random access occasion, wherein each downlink signal is a synchronization signal block, SSB; obtaining a first indication, wherein the first indication indicates a first downlink signal; obtaining a second indication, wherein the second indication indicates a first random access occasion in a plurality of random access occasions corresponding to the first downlink signal; and sending, based on the first indication and the second indication, a random access preamble via the first random access occasion, wherein the correspondence between the first downlink signal and the random access occasions is determined based on the configuration information element; characterised in that: a value of ssb-perRACH-Occasion is 1/8, the second indication comprises a mask index, and wherein the mask index has a 4-bit value, wherein: eight values of the mask index respectively indicate eight random access occasions; one value indicates all random access occasions corresponding to the first downlink signal, wherein the first random access occasion is selected from the all random access occasions; one value is used to indicate odd-numbered random access occasions, wherein the first random access occasion is selected from the odd-numbered random access occasions; one value is used to indicate even-numbered random access occasions, wherein the first random access occasion is selected from the even-numbered random access occasions; and other values are reserved. receiving a configuration information element from a network device, wherein the configuration information element indicates a correspondence between a downlink signal and a random access occasion, and the correspondence between the downlink signal and the random access occasion comprises a quantity of downlink signals per random access occasion, wherein each downlink signal is a synchronization signal block, SSB; obtaining a first indication, wherein the first indication indicates a first downlink signal; obtaining a second indication, wherein the second indication indicates a first random access occasion in a plurality of random access occasions corresponding to the first downlink signal; and sending, based on the first indication and the second indication, a random access preamble via the first random access occasion, wherein the correspondence between the first downlink signal and the random access occasions is determined based on the configuration information element; eight values of the mask index respectively indicate eight random access occasions; one value indicates all random access occasions corresponding to the first downlink signal, wherein the first random access occasion is selected from the all random access occasions; one value is used to indicate odd-numbered random access occasions, wherein the first random access occasion is selected from the odd-numbered random access occasions; one value is used to indicate even-numbered random access occasions, wherein the first random access occasion is selected from the even-numbered random access occasions; and other values are reserved.